I've recently swapped the domain extension of a site from .xyz to .com and I'm using a rule in my nginx config to 301 traffic from the old domain to the new one.
server {
listen 8080;
server_name example.xyz www.example.xyz;
return 301 https://www.example.com$request_uri;
}
However I want to continue serving a sitemap at example.xyz/sitemap.xml
Is there a rule I can implement which will take preference over the 301 just for a single location? The sitemap can be a static file so I can use an alias but not sure how to stop the 301 taken effect for just that url?