Troubleshooting SEOPress XML Sitemap Redirects and 404 Errors
Content
XML sitemaps are a critical component of any website's SEO strategy, helping search engines discover and index your content. However, users of the 'SEOPress – On-site SEO' plugin sometimes encounter issues where their sitemap URLs redirect unexpectedly, lead to a 404 error, or redirect to the homepage. This guide will explain why these issues occur and provide the most common, effective solutions based on community reports and resolutions.
Common Symptoms
- Visiting
/sitemap.xmlor other common sitemap URLs does not show the XML content. - The sitemap URL returns a 404 "Page Not Found" error.
- The sitemap URL redirects to the website's homepage.
- Search engines like Google report that the sitemap "doesn't contain any URLs" or cannot be read.
- Changes to sitemap settings do not seem to take effect.
Why This Happens
These problems are almost always related to how WordPress handles its internal rewrite rules, which control the pretty permalinks for all content, including XML sitemaps generated by plugins like SEOPress.
- Outdated Rewrite Rules: The most common cause is that WordPress's internal list of URL routes is outdated. When you activate, deactivate, or change settings in a plugin that affects URLs (like a sitemap), these rules need to be refreshed.
- Cached Configurations: Server-level or object caching can sometimes serve an old version of the website's configuration, preventing new sitemap URLs from working correctly.
- Plugin Conflicts: Code from other plugins or your theme can interfere with the normal generation or redirection of sitemap URLs.
- Multisite or Complex Server Setups: Websites running on multisite installations or specific server software like NGINX may require additional configuration for rewrite rules to work properly.
How to Fix Sitemap Redirect and 404 Issues
The following troubleshooting steps are listed from the most common and easiest solution to more advanced fixes.
Solution 1: Flush Your Permalinks (The Most Common Fix)
This is the first and most important step to try. Flushing permalinks forces WordPress to rebuild its internal rewrite rules, which often resolves sitemap issues immediately.
- Navigate to your WordPress admin dashboard.
- Go to Settings > Permalinks.
- Do not change any settings. Simply click the "Save Changes" button at the bottom of the page.
- Clear any site or server cache you may have (e.g., from a caching plugin, Cloudflare, or your host's control panel).
- Retest your sitemap URL (e.g.,
yoursite.com/sitemaps.xml).
Solution 2: Toggle the SEOPress Sitemap Feature
If flushing permalinks alone doesn't work, try reactivating the sitemap feature itself to ensure it registers its rules correctly.
- Navigate to SEOPress > XML / HTML Sitemap.
- Toggle the main "XML Sitemap" switch to OFF and save changes.
- Flush your permalinks again (Settings > Permalinks > Save Changes).
- Return to the SEOPress sitemap settings and toggle the main switch back to ON. Save changes.
- Flush your permalinks one final time.
- Clear your site and server cache again and retest.
Solution 3: Check for Conflicts
A theme or plugin conflict could be intercepting requests to sitemap URLs. To test for this:
- Temporarily switch your theme to a default WordPress theme like Twenty Twenty-Four.
- Deactivate all other plugins except SEOPress.
- Test if your sitemap is now loading correctly.
- If it works, reactivate your plugins one by one, testing the sitemap after each, to identify the culprit.
- Finally, reactivate your original theme to see if it causes the issue.
Solution 4: Advanced Server Configuration (For NGINX Users)
Users on NGINX servers, particularly in multisite environments, may find that the standard WordPress permalink flush is not sufficient. The SEOPress team has provided sample NGINX rewrite rules for single sites. If you are technically comfortable, you may need to adapt these rules for a multisite setup. Consulting your hosting provider's support or a system administrator is recommended for this step.
Important Notes on Sitemap URLs
- The official sitemap index file generated by SEOPress is
sitemaps.xml(plural). The plugin includes automatic redirections from other common URLs like the singularsitemap.xmlto the correct plural version. - According to Google's own documentation, the specific URL of a sitemap does not impact SEO, as long as it is a valid, accessible URL that you submit to Search Console.
By following these steps, most users can successfully resolve issues with their SEOPress XML sitemap not loading correctly. If problems persist after trying all these solutions, it can be helpful to search the wider WordPress community for advice specific to your unique server configuration or plugin combination.
Related Support Threads Support
-
HOWTO: redirect sitemap.xml -> sitemaps.xmlhttps://wordpress.org/support/topic/howto-redirect-sitemap-xml-sitemaps-xml/
-
plugin update and sitemaphttps://wordpress.org/support/topic/plugin-update-and-sitemap/
-
XML Sitemap > 404 error / multisite on NGINXhttps://wordpress.org/support/topic/xml-sitemap-404-error-multisite-on-nginx/
-
Author page redirecthttps://wordpress.org/support/topic/author-page-redirect-2/
-
subdirectory not showing in sitemaphttps://wordpress.org/support/topic/subdirectory-not-showing-in-sitemap/
-
sitemaps bug and question about url structurehttps://wordpress.org/support/topic/sitemaps-bug-and-question-about-url-structure/
-
Trailing slash redirect for news.xmlhttps://wordpress.org/support/topic/trailing-slash-redirect-for-news-xml/
-
Wrong sitemaps_xsl url when we have a custom siteurlhttps://wordpress.org/support/topic/wrong-sitemaps_xsl-url-when-we-have-a-custom-siteurl/
-
Redirections feature is missing!https://wordpress.org/support/topic/redirections-feature-is-missing/
-
XML Sitemap toggle option does nothinghttps://wordpress.org/support/topic/xml-sitemap-toggle-option-does-nothing/
-
BUG REPORT: Redirection ‘tick’ being removedhttps://wordpress.org/support/topic/bug-report-redirection-tick-being-removed/
-
no sitemaphttps://wordpress.org/support/topic/no-sitemap-5/
-
Remove /category/ and XML sitemaphttps://wordpress.org/support/topic/remove-category-and-xml-sitemap/
-
Weird handling of XML sitemap URLhttps://wordpress.org/support/topic/weird-handling-of-xml-sitemap-url/
-
Automatic redirections from other common sitemaps URLshttps://wordpress.org/support/topic/automatic-redirections-from-other-common-sitemaps-urls/
-
Disabled sitemap xml, but still redirectshttps://wordpress.org/support/topic/disablet-sitemap-xml-but-still-redirects/
-
Page sitemap is redirectinghttps://wordpress.org/support/topic/page-sitemap-is-redirecting/
-
Sitemap line disappeared in robots.txt filehttps://wordpress.org/support/topic/sitemap-line-disappeared-in-robots-txt-file/
-
301 redirection to /sitemaps.xml not reliablehttps://wordpress.org/support/topic/301-redirection-to-sitemaps-xml-not-reliable/
-
I’m using SEOPress plugin but getting issues in sitemaphttps://wordpress.org/support/topic/im-using-seopress-plugin-but-getting-issues-in-sitemap/
-
XML Sitemap Redirect to Homepage After Installing SeoPress Pluginhttps://wordpress.org/support/topic/xml-sitemap-redirect-to-homepage-after-installing-seopress-plugin/
-
URL of disabled sitemap.xml redirects to home pagehttps://wordpress.org/support/topic/url-of-disabled-sitemap-xml-redirects-to-home-page/
-
Error /sitemaps/category.xmlhttps://wordpress.org/support/topic/error-category-sitemap-xml/