I have set up a _redirects file (site name thegist.netlify.app) in order to redirect one of my domain aliases to a subdomain of the primary domain. The file contents look like this:
Hey @samason,
Can you say more about what you’re trying to do? Do you want the URL in the address bar to change to one of these domain names or the other? Currently, thegistnews.ca is a domain alias of thegist.netlify.app:
Hey @jen,
I would like when I go to thegistnews.ca that it redirects to ca.thegistsports.com, which is a branch deploy of the main site. Am I able to do that with the _redirects file?
Hey @samason,
I escalated this to @fool and we both took another look today. Yes, you can redirect from a domain alias to a primary domain subdomain… and from what we looked at today, you seem to be doing it already? Is that not the case?
@sublet, we looked at your site too and your redirect is set up correctly. Your site is password-protected, so you’ll have to enter the password twice in order to get to the redirected site. But again, it seems like it’s working? It does seem like your site assets are not loading because, for example, https://bails.cc/style.css lives at https://simplybail.com/style.css, not https://simplybail.com/m/style.css. Here’s a thread on redirects with static assets that might be useful:
@jen Thanks for jumping back in here. The redirect actually wasn’t working until i took the password off but it looks like we are good to go now. Thanks.
@jen I believe I have it set up to do this correctly, however when I go to thegistnews.ca in my browser redirects to the primary domain without any subdomain.
I haven’t dug into this any further than my simple suggestion here, but any time we’re playing with 301’s, the 301 response is truly meant to imply that a redirect is permanent, and your browser may be caching that information …somewhat permanently. Can you hit your domain/path a couple of times from the CLI to ensure that you’re getting the correct redirect code(s) back with the correct Location header(s)?
Ah thanks @jonsully, I probably should have checked if it was caching. It wasn’t properly redirecting in incognito mode so I assumed caching wasn’t the issue but I confirmed that it is properly set up and has the correct headers when hit.