XML Sitemap rewrite rules for nginx

Need help with this?
Purchase All in One SEO Pack Pro to get dedicated support from us.

Buy Now

If you’re getting a 404 for your All in One SEO Pack XML sitemap on nginx, then please use the following rewrite rules in your config file (if you don’t know what to do with these, then you shouldn’t be using nginx in the first place):

rewrite ^/sitemap.xml$ /index.php?aiosp_sitemap_path=root last;
rewrite ^/sitemap_(.+)_(\d+).xml$ /index.php?aiosp_sitemap_path=$1&aiosp_sitemap_page=$2 last;
rewrite ^/sitemap_(.+).xml$ /index.php?aiosp_sitemap_path=$1 last;

You might also need to use these rewrite rules if /sitemap.xml keeps redirecting to you to /sitemap_index.xml, which is the sitemap slug of a competing SEO plugin. You’ll also need to remove the rewrite rules for that specific plugin.

If this doesn’t work for you, then please contact us.

  • Was this helpful ?
  • YesNo
Skip to toolbar