Redirecting deployed sites HTTPS to another HTTPS

Hey,
I am having two sites with custom external domains hosted on Netlify.
I need to achieve redirecting them so when typing website1.co it will redirect to website2.com. I am not sure what are my possibilities to achieve it ? I found redirecting only for alias names.

Hi @Petra Welcome to the Netlify community!

You can create domain-level redirect rules as per instructions in the docs

Let us know if you run into any troubles.

Thank you for the answer. I already tried that in my public folder in _redirect

Current _redirect file looks like this:
/* /index.html 200

So what I did was to delete the line and replace with:
https://website1.co/* https://website2.com 301!

Did not work and page was also broken. I am trying to solve it for some time now and it is very important for me to get it running ASAP. Is there anything additional I need to do or am I missing something ?

Make sure the file is called _redirects, NOT _redirect.

This will redirect all pages on your site to index.html on your site, not to another site. If you still have this rule, remove it.

You would place the rule below at the top of your _redirects file.

I followed the steps, it does not work. when I am typing website1.co it should go to website3.com, but it does not at all.

Can you post the contents of your _redirects file.

This is the content of _redirects

https://omnified.co/* https://theomnified.com 301!

I believe your bare domains (e.g. omnified.co) are aliases and configured to automatically redirect to your www (e.g. www.omnified.co) which are your primary domains. (You can check this under the Site settings tab of Netlify admin.)

Therefore, you would need to add

https://www.omnified.co/* https://www.theomnified.com/:splat 301!

to your _redirects too.

1 Like

Okay perfect. And both domains needs to be hosted by Netlify? Or is it possible to have omnified.co hosted on other server ?

You could have omnified.co elsewhere if you wish. It depends on the functionality you wish to have on your URLs. If your site is indexed by search engines, have oldsite.com/page.html redirect to newsite.com/page.html is ideal. You may not have this ability if you move your old domain elsewhere.