I have a primary domain, and I’d like to make a secondary domain as a redirect to the primary.
Currently they are both working as 2 separate domains, but I’d like to have only one primary and the other one redirecting.
Note: that is 301! and not just 301 above - the exclamation mark is important and must be included
You can the same rule in netlify.toml format like this:
[[redirects]]
from = "https://second-domain-to-redirect.org/*"
to = "https://original-site.org/:splat"
status = 301
force = true
Just replace the domains above (original-site.org and second-domain-to-redirect.org) with the real domains for your site. Note, you may need to duplicate this redirect for the www subdomain like so:
Hi, @podrivo. I believe I found the site (as no other sites on your account have any deploys on November. The current deploy’s _redirects syntax is wrong.
You said it looks like this (and this would work if this is how the rule was written - but it’s not):
You did not include https:// in the starting URL. You started the URL with just / so it is being treated as a path and not as a URL. If you write the redirect rule as required, it will work.
OMG, Luke! Thank you for pointing it out! I did the update in a different file…
It is really working this time as you mentioned, so thank you so much for your help! <3