How to Fix a 404 Error When Viewing Your Sitemap

If you are seeing a 404 error Page Not Found when viewing the sitemaps generated by All in One SEO then this article will help you troubleshoot this.

There are a number of reasons why All in One SEO cannot generate a sitemap and WordPress returns a Page Not Found error. These are listed below along with steps to check whether this is affecting your site.

The sitemap is disabled

First, check whether you've enabled the sitemap by going to All in One SEO » Sitemaps and click on the tab for the sitemap you're having problems with.

Is the Enable Sitemap setting toggle in the On position? If it's not, then click the toggle to enable the sitemap and click the Open Sitemap button to view the sitemap.

Enable Sitemap toggle and Open Sitemap button on Sitemaps screen

If you are using the Video Sitemap and/or the News Sitemap in All in One SEO, then you should also use the main XML Sitemap in All in One SEO.

There is no content

This may seem like a silly question to ask, have you made sure that you have published content on your site that you're including in the sitemap?

Check the Post Types and Taxonomies settings to verify which content you've selected to include in your sitemap.

If this is the News Sitemap, then you must have content that has been published in the last 48 hours. Any content older than this is not included in the News Sitemap as per Google's requirements.

The content is set to noindex

This is directly related to “There is no content” above. All in One SEO does not include content in the sitemap that is set to Noindex.

So if you've set the Show in Search Results to No under Search Appearance or enabled No Index using the Robots Meta settings under Search Appearance or on your content then this content will be excluded from the sitemap.

The NGINX rewrite rules haven't been added

If your server is running NGINX then you may need to add the NGINX rewrite rules here.

If you're on All in One SEO version 4.2.2 or lower then sitemaps will only work with “pretty permalinks”.
Go to Settings » Permalinks on your site and verify that it's set to something other than Plain.

The sitemap name has been changed in the database

This can be a little more difficult to check for. The easiest way is to go to All in One SEO » Tools » Import / Export and in the Export Settings area, check the box for Sitemaps and click the Export Settings button.

Export sitemap settings from Import/Export tool

Open the aioseo-export-settings.json file that was downloaded to your computer and search for “filename”. If the value is anything other than “sitemap” for the XML Sitemap and “video-sitemap” for the Video Sitemap then the filename of the sitemap has been changed.

You can change it back in the export file and then import the settings.

CDN Plugin includes XML or XSL

If you're using a CDN service or CDN plugin, then check to see if deactivating the plugin or service resolves the problem. Some CDN services and plugins include XML and XSL URLs when they shouldn't.

To exclude the XML Sitemap from caching, please refer to the instructions here.

If you are using a different plugin or caching is done at the server level then contact the plugin developer, service provider, or your hosting company to find out how to exclude XML and XSL URLs.

If you are seeing a 404 error Page Not Found when viewing the sitemaps generated by All in One SEO then this article will help you troubleshoot this.

There are several reasons why All in One SEO cannot generate a sitemap and WordPress returns a Page Not Found error. These are listed below along with steps to check whether this is affecting your site.

There is no content

This may seem like a silly question to ask, have you made sure that you have published content on your site that you're including in the sitemap?

Check the Post Types and Taxonomies settings to verify which content you've selected to include in your sitemap.

If this is the News Sitemap, then you must have content that has been published in the last 48 hours. Any content older than this is not included in the News Sitemap as per Google's requirements.

The content is set to noindex

This is directly related to "There is no content" above. All in One SEO does not include content that is set to Noindex.

So if you've selected content in the Default to NOINDEX setting under All in One SEO » General Settings » Noindex Settings or enabled Noindex this page/post on your content then this content will be excluded from the sitemap.

The NGINX rewrite rules haven't been added

If your server is running NGINX then you may need to add the NGINX rewrite rules here.

Permalinks are set to Plain

The sitemaps will only work with "pretty permalinks" so go to Settings » Permalinks on your site and verify that it's set to something other than Plain.

The sitemap name has been changed in the database

This can be a little more difficult to check for. The easiest way is to go to All in One SEO » Importer & Exporter and check the box for Export Settings, uncheck all other boxes and click the Export button.

Open the settings_aioseop file that was downloaded to your computer and search for "filename". If the value is anything other than "sitemap" for the XML Sitemap and "video-sitemap" for the Video Sitemap then the filename of the sitemap has been changed.

You can change it back in the export file and then import the settings.

CDN Plugin includes XML or XSL

If you’re using a CDN service or CDN plugin, then check to see if deactivating the plugin or service resolves the problem. Some CDN services and plugins include XML and XSL URLs when they shouldn’t.

To exclude the XML Sitemap from caching, please refer to the instructions here.

If you are using a different plugin or caching is done at the server level then contact the plugin developer, service provider, or your hosting company to find out how to exclude XML and XSL URLs.