Yoast SEO Plugin Sitemap not found [Solution]

Updated on June 15, 2020

One of the good thing about Yoast SEO plugin is that, it automatically generates XML sitemap. I have been using this plugin on my client websites, and I very well know where the sitemap.xml is located –  generally located under site.com/sitemap.xml (which will be redirected to sitemap_index.xml). But for some reason, I was not able to find sitemap.xml on one of the client’s website. Fortunately, I was able to fix the issue and this tutorial will explain how to fix Yoast SEO plugin sitemap not found error.

The first step is to check if XML Sitemaps are enabled in the Yoast SEO plugin. To do that, you need to enable "Advanced settings".

How to enable Advanced settings in Yoast SEO plugin? (Only on older versions)

Step 1: Login to WordPress admin and click on SEO > Dashboard.

Step 2: Switch to Features tab

Step 3: Toggle "Advanced settings page" button to enable it.

Once the advanced settings are enabled, you will find more menu items including XML sitemaps under SEO menu in the WordPress dashboard.

How to enable XML sitemaps in Yoast SEO?(Only on older versions)

Step 1: Click on SEO > XML Sitemaps from the dashboard menu.

Step 2: Ensure "XML sitemap functionality" is enabled. If not, click on the toggle button to enable it.

Well, now the XML sitemaps feature is enabled by the plugin.

How to fix Yoast SEO Plugin Sitemap not found on NGINX

Step 1: Click on SEO > XML Sitemaps

Step 2: Click on “XML Sitemap” button to see if the sitemap has been generated.

Step 3: If you see 404 not found error, then follow the below steps to fix the same.

According to the official documentation from Yoast SEO, you will have to add the below lines in NGINX configuration file.

Basic code:

# Rewrites for Yoast SEO XML Sitemap
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

In case if the basic code didn’t work, then try the advanced code.

#Yoast SEO Sitemaps
location ~ ([^/]*)sitemap(.*).x(m|s)l$ {
## this rewrites sitemap.xml to /sitemap_index.xml
rewrite ^/sitemap.xml$ /sitemap_index.xml permanent;
## this makes the XML sitemaps work
rewrite ^/([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 last;
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
## The following lines are optional for the premium extensions
## News SEO
rewrite ^/news-sitemap.xml$ /index.php?sitemap=wpseo_news last;
## Local SEO
rewrite ^/locations.kml$ /index.php?sitemap=wpseo_local_kml last;
rewrite ^/geo-sitemap.xml$ /index.php?sitemap=wpseo_local last;
## Video SEO
rewrite ^/video-sitemap.xsl$ /index.php?xsl=video last;
}

Still seeing 404 not found error? Then you may have to contact your hosting provider to fix the same.

Was this article helpful?

Related Articles

Leave a Comment