I have magento 2 store and when i create a sitemap it works ok , but after that when i want to access the newly created sitemap it throw 404 error page.i'm using nginx server.
how can i fix this ??
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityyou should check the rules of nginx, the root dir of nginx is set to /pub/ but that is not the correct directory for nginx to search for the sitemaps. so you should configure a location for nginx one level under the pub (the real root dir of mage2) and there will nginx find the sitemaps. I create all sitemaps in a subdir "sitemaps". mine looks like this:
#sitemap.xml
location /sitemaps/ {
root /var/www/production/current;
try_files $uri =404;
allow all;
}
Pub folder the name suggests as publicly accessible folder, so moving the file sitemap.xml from HTML to the pub folder will resolve the issue