Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

How to Fix Yoast’s WordPress SEO Sitemap 404 Error

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Are you trying to fix Yoast SEO’s sitemap 404 error in WordPress?

Yoast SEO is one of the most popular SEO plugins for WordPress. Due to a plugin conflict or incorrect WordPress settings, it may show a 404 error when you try to visit your XML sitemap.

In this article, we’ll show you how to easily fix the Yoast SEO XML sitemap 404 error in WordPress.

Fixing Yoast SEO XML sitemap 404 error in WordPress

What’s Causing Yoast SEO Sitemap 404 Error in WordPress?

The Yoast SEO sitemap helps search engines find all the content on your website that you want them to find and index.

Fixing the error ensures that search engines can access your sitemap and discover all the pages and content on your site, which can lead to better search engine visibility and ranking. This will also help to rank your content faster than without a sitemap.

WordPress comes with a default XML sitemap that you can submit to Google Search Console and other search engines.

This XML sitemap can be visited by entering the following URL in your browser’s address bar.

However, this default WordPress-generated sitemap is very basic. To fix this, all top WordPress SEO plugins like All in One SEO for WordPress or the Yoast SEO plugin create their own XML sitemaps with more features.

When you use the XML sitemap generated by your WordPress SEO plugin, these plugins rewrite the default WordPress XML sitemap shortcut.

This means the sitemap URL mentioned above will now send users to the sitemaps generated by your WordPress SEO plugin.

Unfortunately, this may cause a 404 error on some websites due to plugin conflicts or incorrect WordPress settings.

That being said, let’s take a look at how to easily fix the WordPress sitemap 404 error in the Yoast SEO plugin.

1. Refresh WordPress Permalink Structure

WordPress comes with an SEO-friendly URL structure (also called permalinks). This URL structure uses a redirect system to tell your web hosting server which page to load when a user enters a URL in their browser.

Normally, these permalinks settings are automatically updated when you make changes to your website.

However, sometimes WordPress may not be able to refresh the permalink structure, which may cause Yoast SEO’s sitemap 404 error to appear.

This can be easily fixed by visiting the Settings » Permalinks page in the WordPress admin area and simply clicking on the ‘Save Changes’ button.

Update permalinks

Doing so will refresh the WordPress permalink settings. You can now visit your XML sitemap page to see if this has fixed your problem.

If it didn’t fix the problem, then you can continue reading.

2. Manually Update Permalinks

If refreshing your WordPress permalink structure doesn’t fix the 404 error, then you can manually tell your web server to redirect users to Yoast SEO’s sitemap page.

To do this, you’ll need to add the following code to your .htaccess file.

# Yoast SEO - XML Sitemap Rewrite Fix
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?yoast-sitemap-xsl=$1 [L]
# END Yoast SEO - XML Sitemap Rewrite Fix

Note: If your WordPress website is installed in a subdirectory or folder (e.g. ), then you’ll need to use the following code.

# Yoast SEO - XML Sitemap Rewrite Fix
RewriteEngine On
RewriteBase /mywebsite/
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?yoast-sitemap-xsl=$1 [L]
# END Yoast SEO - XML Sitemap Rewrite Fix

Don’t forget to replace /mywebsite/ with your subdirectory name.

This code simply tells your web server which pages to display when users access Yoast SEO’s XML sitemaps.

You can now try viewing your XML sitemap to see if this resolves your issue.

3. Switch to an XML Sitemaps Plugin

If the above-mentioned methods didn’t solve the 404 error on Yoast SEO’s XML sitemap page, then you can try using a separate plugin to generate XML sitemaps for your website.

The disadvantage of this approach is that you’ll have to rely on a separate plugin to generate XML sitemaps and Yoast SEO for other SEO features.

First, you need to install and activate the XML Sitemaps plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Since you are using Yoast SEO, it will automatically show you a notification to either disable the XML Sitemaps plugin or Yoast SEO’s sitemap functionality.

Yoast SEO XML Sitemap conflict warning

Click on the Toggle Yoast SEO’s XML Sitemap button to continue.

This will bring you to the Features tab under the SEO » General page. From here, you need to scroll down to the XML Sitemaps option and switch it off.

Disabling XML sitemaps in Yoast SEO

Don’t forget to click on the ‘Save Changes’ button to store your settings.

You can now switch to the Settings » XML-Sitemap page to configure your sitemaps. For most websites, default settings would work out of the box.

XML Sitemaps settings

But you can always configure the settings based on your needs.

You can now submit the XML sitemap URL to the Google search console and other search engines.

Sitemap URL

4. Switch to the All in One SEO for WordPress

If all steps to troubleshoot fail and you don’t want to use a separate plugin to generate XML sitemaps, then this method may help you fix the sitemap 404 error issue.

For this method, you’ll need All in One SEO for WordPress. It is the best WordPress SEO plugin on the market and a much better Yoast SEO alternative.

You can see our Yoast vs All in One SEO comparison for more details on the differences.

All in One SEO (AIOSEO) comes with advanced XML sitemaps with easy-to-manage options that give you full control of what to include or exclude from your XML sitemaps.

First, you need to install and activate the All in One SEO for WordPress plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Note: There is also a free version of All in One SEO for WordPress, which includes most XML sitemap features except for video and news sitemaps.

Upon activation, the plugin will walk you through a setup wizard. You can follow our guide on how to properly set up the All in One SEO plugin for WordPress if you need help during setup.

All in One SEO setup

All in One SEO will also allow you to import SEO data from Yoast SEO.

This ensures that all your previous SEO meta tags and titles remain unchanged.

Import Yoast SEO data

After the initial setup, you can go to All in One SEO » Sitemaps page to configure XML sitemap settings.

All in One SEO sitemaps settings

You can click on the Open Sitemap button to see if it fixed the sitemap 404 error in WordPress.

After that, you configure sitemap settings if needed.

For instance, All in One SEO allows you to choose what to include in your sitemaps. You can add or remove post types, taxonomies, individual posts, and pages.

All in One SEO sitemaps advanced settings

All in One SEO also allows you to create video, news, RSS sitemap, and HTML sitemap for your website.

Additional sitemaps

These sitemaps can also be submitted to Google Search Console and other search engines. This helps search engines quickly find newer content on your website.

We hope this article helped you fix the Yoast SEO Sitemap 404 error in WordPress. You may also want to see our complete WordPress troubleshooting guide or see how to fix common WordPress errors.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

243 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Reyhan Emilia says

    Thank you because yoast had brought me to an impossible point. I will always read your blogs. You are perfect.

  3. Scott Baranek says

    Thank you so much for this article!!! I have been speaking with multiple people and support teams and I always knew it was something easy. Article was broken down for easy understanding as well. Thank you!!!

  4. Binod Raj Joshi says

    Hey, wpbeginner, I was in sitemap trouble from a few days, now it have been solved. Learning a lot from you guys about wp error fixing, thanks!

  5. saurab says

    After moving to https from http, Sitemap address is displaying 404 error, Is it possible know the solution for this ?

  6. Ashish Sharma says

    Nice pluging , but when I am creating sitmap using yoast and submitting it to webmaster it is showing 404 error for multiple urls. I searched in my site no where those urls exist. But y these are coming into sitemap I don’t understand any expert to help me

  7. RAJEEV KUMAR says

    Sir, In my WordPress blog, 410 Response code error are showing in Yoast SEO’S Search Console feature. How I fix It.

  8. Tracy Pope says

    I tried to download the Yoast SEO plug in and I received this error message:

    Fatal error: Call to undefined function apply_filters_deprecated() in /websites/websitename/wp-content/plugins/wordpress-seo/admin/menu/class-admin-menu.php on line 246

    I now can’t get into my back end of the website at all I just keep getting this error? What can I do??

    • WPBeginner Support says

      Hi Tracy,

      You need to connect to your website using FTP or File Manager app in your cPanel account. Go to wp-content/plugins/ and delete wordpress-seo folder. After that you will be able to login to your WordPress admin area and reinstall the plugin.


  9. Amit says


    To edit the .htaccess file do we need to remove the existing code and add your code


    keep the existing code and add your code also?

    Need help.

  10. Keitai says


    Tried every suggestion but still got a 404. somehow i can’t redirect xml html htm php file extensions.

    when i try
    RewriteRule ^sitemap_index.xl$ /site/index.php?sitemap=1 [L] and not
    RewriteRule ^sitemap_index.xml$ /site/index.php?sitemap=1 [L]

    Hence, i removed the “m”, and the redirect works but sitemap_index.xml doesn’t

    Any more tips?

  11. Tony says

    @wpbeginner support. I have already gotten the sitemap, the issue when I submit it to google for test it bring out an error http 404. I have read your post on how to edit .ht access file and wp seo. I have also check and unchecked the yoast plugin. But it hasn’t resolved the http 404. Please help

  12. Tony says

    i just opened a new WordPress site. I have tried everything still the site app generated by yoast seo is still showing http 404 error. What do I do. The website is . please note I have edited my .htaccess file, edited wp-content/Wordpress. Pap, unchecked and checked site map settings for seo, saved permalinks. I even used a free sitemap generator upload the file via my Cpanel but still am getting the same error

  13. nageswarao says

    hi bro my website Google XML Sitemaps not showing last 5 months (sitemap-pt-post-2016-06.xml end after not showing) and also sitemap-tax-post_tag.xml not showing how to solve my problem

  14. Nik says

    Thanks! I was having the hardest time getting it to work and the first section with the .htaccess code did the trick!

  15. Kunal Sarkar says

    Hi all,

    I was facing the same problem while I came across this blog post. But I guess I found a better solution for non-tech guys.

    You can simply install JetPack from WordPress and Activate its Sitemap functionality and disable the Sitemap of Yoast. Additionally Jetpack has a lot of essential features that I guess every WP admin should have.

    Kunal Sarkar

  16. Shivam says

    For me there is a different issue. Its just showing plain text instead of links. Can some one help please

  17. Naman Kumar says

    Hey, I’m using the same code goy fixing yoast xml sitemap but what to do for google analytics by yoast?

  18. Mohammed Jhosawa says

    Hi Guys,

    Please follow this steps if you are facing 404 error issue with Yoast XML Sitemap :

    1. Go to > Yoast SEO Plugin.
    2. Yoast SEO Plugin > XML Sitemap.
    3. Uncheck the user XML Sitemap functionality > Save Changes.
    4. Again Check XML Sitemap functionality > Save Changes.
    5. Click on XML Sitemap and you’ll see your sitemap_index.xml right there.

    Hope this information is useful to you.


  19. Felix says

    Yo here is an easy way to fix it and should work fine for all!

    Go to settings in wordpress

    Select permalinks

    Don’t change anything

    Just Press save changes at the bottom of the page

    Now click on your XML Site Map button again in Yoast

    404 error should no longer show

    You welcome homies

  20. Tim says

    Simply untick “Check this box to enable XML sitemap functionality.” in the SEO plug-in and Save Changes, then renable again. Problem solved.

  21. Miro says

    After adding the first code to your htacces file disable sitemap functionality flush your cache (if you use any of caching tools like w3 total cache) and then enable the functionality again.
    It worked for me that way.

    Thank you for the tutorial! It helped!

  22. Joe says

    Hey guys. I fixed it! I turned this sitemap option off in this flawless plugin and used a different plugin. It was that easy. It was probably my crummy theme though. Probably.

  23. Atanas Tanev says

    Ok guys. I was struggling with this issus for a day or so and finally I found the solution!

    Skip the mentioned plugins and the codes which may harm your website. I’ve tried everything!

    Simply uncheck the “remove strip” from yoast plugin and instead of this option just download and install the plugin: “Remove Category URL” from wordpress plugin section.

    The plugin supports WPML and sitemaps and the 404 error is fixed!

    Now you can buy me a beer for saving all your headaches!


    Atanas Tanev

    • Nirav Dave says

      Hey ATANAS!

      No way man! This solution worked for me mate. Thank you so much for sharing this.


  24. Bas says

    i placed the code in my .htaccess file and saved it. Now every page gives a 500 internal server Error!!!
    What can i do?

    • Miles O'Brien says

      What I did was I went to the xml sitemap page under the SEO plugin and under user sitemap I unchecked disable user sitemap. then when I put in the sitemap into webmasters it worked successfully. I can’t help you with your 500 internal error, But if you do this fresh it should work instead of using the code.

    • Rafael says

      BAS: Remove the code you entered into your.htaccess file, resave it to the server and reload the website.

  25. Henry says

    If anyone is using iThemes security plug in and has set it to guard the .htaccess file, disable it and create your sitemap, then re-enable.

  26. Nikos Kavvadas says

    I add the code in the .htaccess and then i uncheck the sitemap option in the Yoast’s SEO plugin and save their settings. After that i re-checking the sitemap’s option and the the error is solved!


  27. Morteza says

    Thanks a lot, but not works for me. I do all of these ways and check/save/uncheck/save/XML Sitemap process after one & both of them… but ERROR 404!
    I’ll try another plugins for this.
    thanks for your great site..

  28. TimValDen says

    Worked for me too… I had the 404page problem when loading the sitemap generated by Yoast SEO.

  29. Joshua Largent says

    This is what worked for me – Go to the yoast XML sitemap on your dashboard. Change the Max Entries per sitemap from 1000 to 100. Worked like a charm for me. :)

    • Tony says

      Easy does it again, change from 1000 to 100 did the job, without changing the code. Thank You!

Leave a Reply to Deborah Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.