Fix sitemap.xml 404 Not Found

You might activate Rankmath on your wordpress and suddenly when you click your sitemap URL and it showing 404 not found.

You’re not alone.

Looks like if you are using Runcloud or Nginx as your server, you need to define the nginx config on sitemap.

Luckily Rankmath already have this. You can refer here.

If you’re using Runcloud, you can add this config.

Go to you web app > NGINX Config > Add.

Add the config line below:

rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
rewrite ^/([a-z]+)?-sitemap\.xsl$ /index.php?xsl=$1 last;

That’s it. You’re good to go now.

Leave a Reply

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