Home
Support Forums

Redirect from domain alias to primary domain is not working

My site (mystifying-shirley-1496ab.netlify.app/) is currently up and running with two custom domains, one primary and one alias. Both domains are connected to the site correctly as both resolve to the current deployed site.

However, the domain alias represents a previous name for our organization. I’d like to setup the _redirects file to have the old domain (our alias) redirect to the new domain (our primary). I have the following lines in the _redirects file:

http://haltoncatholictrustees.com/* https://haltonparentsforchange.ca 301!
https://haltoncatholictrustees.com/* https://haltonparentsforchange.ca 301!
http://haltonparentsforchange.com/* https://haltonparentsforchange.ca 301!

Unfortunately, the redirect does not seem to be working. Is there something I’m doing wrong?

Thanks!

Hi @ian.mccombe

In you latest deploy, do you see something like this?

If not, then the redirects were not processed. Is the _redirects file in the publish directory? To check, download your deploy and see if the _redirects file is there.

You might also want to add a :splat to capture the * e.g.

http://haltoncatholictrustees.com/*    https://haltonparentsforchange.ca/:splat    301!

Thanks for the reply!

Yes, in the most recent deploy I can see that there were 4 redirect rules processed (the three I posted about plus one generic

/* /index.html 200

I tried the splat before during a few debugging attempts but it didn’t seem to make a difference. I can try adding it again and redeploy just to see if it does change anything now.

Where is this generic one? If it is the first rule, that is why the other rules will not work. As stated in the docs rules are processed in order top to bottom. The above rule matches everything, so no other rules below it will get triggered.

You’re 100% correct. I never even considered that it was getting caught there.

Thanks so much for the quick help!