On the server.rewrites
file within the nginx/
map, I have the following logic for redirecting the homepage of an old domain, to the homepage of a new domain:
if ($http_host ~ ^(www\.)?olddomain.com ) {
return 301 https://www.newdomain.com$request_uri;
}
This is not working as expected, because all other url's inside the old domain are also being redirected.
Example: olddomain.com/someurl
is being redirected to newdomain.com/someurl
, and the redirect should only work for the home page.
Any ideas on how I could adjust the above mentioned code? Thanks for your contributions.