Fix for Sitemap 404 Error in WordPress SEO by Yoast on Nginx

By | December 7, 2011

yoast-seo-404-sitemap-errorThis one’s a small post  about how to get rid of the 404 error you get when you try to check your sitemap_index.xml generated by Yoast WordPress SEO plugin , well this can be due to several reasons , so I will present a checklist of fixes for the 404 to go away ,



Initially I will suggest to take a look at Joost De Valk’s Blog post here at ,


Here’s the excerpt from above Post which talks about the 404 error ,


Why do I get a 404 when opening the sitemap_index.xml file?
You probably have W3 Total Cache active, that is preventing 404 errors for static files to go through to WordPress. Update to the latest version of W3 Total Cache or add, under the browser cache page, this exemption:



Now, I have notified him of the fix apart from what all methods he has written there but in case if he’s too busy making awesome plugins for us I thought I will share the solution for this 404 error with you here , Well all you have to do is edit your nginx configuration file for the affected domain and add this directive at the end within your server configuration , before you close the braces.


error_page 404 /index.php;


what this does is redirects all 404’s to index.php which is what WordPress does by default in a Apache server but in Nginx we need to put this and so once WordPress  receives the 404 error on it’s index.php then from there the Yoast SEO plugin does the redirection magic and you are served with your sitemap.


Hope it helped and those who are having problems applying this fix, just comment here and I’ll be happy to help .

Leave a Reply

Your email address will not be published. Required fields are marked *