Reputation: 1241
I'm trying to redirect a TLD to a different domain entirely and am beginning to pull my hair out trying to get to the bottom of it:
Here's an example origin domain:
www.foo.com.au
and the intended destination redirect:
www.bar.com/subpage
As it stands now, here's the rule I have written that returns a 200 response when testing with curl:
RewriteCond %(HTTP_HOST) ^(?:www\.)?foo\.com\.au$ [NC]
RewriteRule (.*) https://www.bar.com/subpage [R=301,L]
Anything you can point out would be greatly appreciated. Thank you!
Upvotes: 1
Views: 101
Reputation: 1241
Figured this one out, guys.
The rewrite rule/condition was correct save for one thing..... curly braces instead of parentheses to encapsulate HTTP_HOST.
RewriteCond %{HTTP_HOST} ^(?:www\.)?foo\.com\.au$ [NC]
RewriteRule (.*) https://www.bar.com/subpage [R=301,L]
This code has the redirect working as expected. Details, details.
Upvotes: 1