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 ??

enter image description here

2 Answers 2


Put your sitemap in the /pub/ folder:

enter image description here

Then go to http://www.domain.com/sitemap.xml


you 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:

location /sitemaps/ {
        root /var/www/production/current;
        try_files $uri =404;
        allow all;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.