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

Så här fixar du Yoasts 404 error i sökmotorsoptimeringens Sitemaping i WordPress

Att hantera ett 404-fel på din Yoast SEO-webbplatskarta i WordPress kan vara frustrerande. Yoast SEO är ett populärt verktyg, men ibland kan en plugin-konflikt eller felaktiga inställningar orsaka det här felet.

Så om du försöker besöka din XML-webbplatskarta och du ser ett 404-fel kan det stoppa dig i dina spår. Men oroa dig inte, det finns enkla lösningar.

På WPBeginner har vi stött på och löst det här problemet, om inte hundra gånger. I den här artikeln guidar vi dig steg för steg för att åtgärda 404-felet i Yoast SEO:s webbplatskarta. Följ bara med för att få din webbplatskarta att fungera smidigt igen.

Fixing Yoast SEO XML sitemap 404 error in WordPress

Vad orsakar Yoast sökmotorsoptimering Sitemap 404 error i WordPress?

Yoast SEO:s sitemap hjälper search engines att hitta allt content på din website som du vill att de ska hitta och indexera.

Genom att åtgärda felet säkerställer du att sökmotorerna kan komma åt din webbplatskarta och upptäcka alla sidor och allt innehåll på din webbplats. Detta kan leda till bättre synlighet och ranking i sökmotorerna, och det kommer också att bidra till att ditt innehåll rankas snabbare än utan en webbplatskarta.

WordPress har en standard XML-webbplatskarta som du kan skicka till Google Search Console och andra sökmotorer.

Denna XML-webbplatskarta kan besökas genom att ange följande URL i webbläsarens adressfält:

https://example.com/sitemap.xml

Denna standard WordPress-genererade webbplatskarta är dock mycket grundläggande. För att åtgärda detta skapar alla de bästa SEO-pluginsen för WordPress, som Yoast SEO och All in One SEO -plugin, sina egna XML-webbplatskartor med fler funktioner.

När du använder den XML-webbplatskarta som genereras av ditt WordPress SEO-plugin skriver plugin-programmet om standardgenvägen för WordPress XML-webbplatskarta.

Detta innebär att webbadressen för webbplatskartan som nämns ovan kommer att skicka användare till de webbplatskartor som genereras av ditt SEO-plugin för WordPress.

Tyvärr kan detta orsaka ett 404 error på vissa websites på grund av konflikter med tillägg eller felaktiga Settings i WordPress.

I följande avsnitt visar vi dig hur du enkelt kan åtgärda 404-felet i WordPress-webbplatskartan i Yoast SEO-plugin. Här är en snabb översikt över alla de metoder vi kommer att täcka:

Är du redo? Låt oss hoppa in direkt.

WordPress levereras med en SEO-vänlig URL-struktur som kallas permalänkar. Denna URL-struktur använder ett omdirigeringssystem för att tala om för din webbhotellserver vilken sida som ska laddas när en användare anger en URL i sin webbläsare.

Normalt uppdateras dessa permalänkinställningar automatiskt när du gör ändringar på din website.

Den dåliga nyheten är att WordPress ibland inte kan uppdatera permalänkstrukturen, vilket kan leda till att Yoast SEO:s sitemap 404-fel visas.

Med detta sagt kan detta enkelt åtgärdas genom att gå till sidan Inställningar ” Permalänkar från WordPress adminområde och helt enkelt klicka på knappen Spara ändringar”.

Update permalinks

Om du gör det uppdateras inställningarna för permalänkar i WordPress. Du kan nu besöka din XML sitemap page för att se om detta har fixat ditt problem.

Om det inte fixade problemet kan du fortsätta läsa.

Om uppdatering av din WordPress permalänkstruktur inte fixar 404 error, kan du manuellt berätta för din web server att redirect användare till Yoast SEO: s sitemap page.

För att göra detta måste du lägga till följande kod i din .htaccess-fil.

# 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

Obs/observera : Om din WordPress website är installerad i ett subdirectory eller en folder (t.ex. https://example. com/mywebsite/ ), måste du använda följande kod.

# 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

Glöm inte att ersätta /mywebsite/ med namnet på din underkatalog .

Denna kod talar helt enkelt om för din web server vilka pages som ska visas när användare öppnar Yoast sökmotorsoptimeringens XML sitemaps.

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

3. Byt till ett tillägg för XML Sitemaps

Om de ovan nämnda metoderna inte löste 404-felet på Yoast SEO:s XML-webbplatskarta-sida, kan du försöka använda ett separat plugin för att generera XML-webbplatskartor för din webbplats. Och ett bra plugin för detta är XML Sitemaps plugin.

Nackdelen med detta tillvägagångssätt är att du måste förlita dig på ett separat plugin för att generera XML-webbplatskartor och Yoast SEO för andra SEO-funktioner.

Först måste du installera och aktivera insticksprogrammet XML Sitemaps. Mer information finns i vår steg-för-steg-guide om hur du installerar ett WordPress-tillägg.

Eftersom du använder Yoast SEO kommer du automatiskt att få ett meddelande om att inaktivera XML Sitemaps-plugin eller Yoast SEO:s funktion för webbplatskartor.

Yoast SEO XML Sitemap conflict warning

Sedan kan du klicka på knappen ”Toggle Yoast SEO’s XML Sitemap” för att fortsätta.

Detta tar dig till fliken ”Funktioner under SEO ” Allmänt. Härifrån måste du bläddra ner till alternativet ”XML-webbplatskartor” och stänga av det.

Disabling XML sitemaps in Yoast SEO

Glöm inte att klicka på knappen ”Save Changes” för att spara dina inställningar.

You can now switch to the Settings ” XML-Sitemap page to configure your sitemaps. För de flesta websites fungerar standardinställningarna direkt från boxen.

XML Sitemaps settings

Men du kan alltid konfigurera settings utifrån dina behov.

Du kan nu skicka webbadressen till XML-webbplatskartan till Googles sökkonsol och andra sökmotorer.

Sitemap URL

4. Byt till All in One SEO för WordPress

Om alla ovanstående misslyckas och du inte vill använda ett separat plugin för att generera XML-webbplatskartor, kan den här metoden hjälpa dig att lösa problemet med 404-felet för webbplatskartan.

För den här metoden behöver du All in One SEO för WordPress. Det är det bästa SEO-plugin-programmet för WordPress på marknaden och ett mycket bättre Yoast SEO-alternativ.

Du kan se vår jämförelse av Yoast vs All in One SEO för mer detaljer om skillnaderna.

All-in-One SEO (AIOSEO) levereras med avancerade XML-webbplatskartor och lätthanterliga alternativ som ger dig full kontroll över vad som ska inkluderas eller exkluderas från dem.

Först ska vi installera och aktivera insticksprogrammet All in One SEO för WordPress. Mer information finns i vår steg-för-steg-guide om hur du installerar ett WordPress-plugin.

Obs: Det finns också en gratisversion av All in One SEO för WordPress, som innehåller de flesta XML-sitemap-funktioner utom för video och nyheter.

Vid aktivering kommer plugin-programmet att leda dig genom en installationsguide. Om du behöver hjälp under installationen kan du följa vår guide om hur du korrekt installerar All in One SEO-plugin för WordPress .

All in One SEO setup

All in One SEO kommer också att tillåta dig att importera sökmotorsoptimering från Yoast SEO.

Detta säkerställer att alla dina tidigare sökmotorsoptimeringar (meta tags och titlar) förblir oförändrade.

Import Yoast SEO data

Efter den första installationen kan du gå till All in One SEO ” Sitemaps page för att konfigurera XML sitemap-inställningar.

Du kan klicka på knappen ”Öppna webbplatskarta” för att se om det har åtgärdat 404-felet för webbplatskartan i WordPress.

All in One SEO sitemaps settings

Efter det konfigurerar du Settings för Sitemap om det behövs.

Till exempel tillåter All in One SEO dig att välja vad du vill inkludera i dina webbplatskartor. You can add or remove post types, taxonomies, individual posts, and pages.

All in One SEO sitemaps advanced settings

Med All in One SEO kan du också skapa video, nyheter , RSS-webbplatskarta och HTML-webbplatskarta för din webbplats.

Det är bara att utforska flikarna för att se om du vill konfigurera fler inställningar.

Additional sitemaps settings

Dessa sitemaps kan också skickas till Google Search Console och andra sökmotorer. Det hjälper sökmotorerna att snabbt hitta nytt innehåll på din webbplats.

Expert tips: Vill du inte åtgärda WordPress-felet själv? Oroa dig inte – vi hjälper dig! Säg adjö till frustrerande fel och återgå till att fokusera på det du älskar. Låt oss ta hand om det tekniska och boka vår akuta WordPress-support nu!

Vi hoppas att den här artikeln hjälpte dig att åtgärda 404-felet i Yoast SEO Sitemap i WordPress. Därefter kanske du också vill se vår kompletta felsökningsguide för WordPress eller se hur du åtgärdar vanliga WordPress-fel.

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.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

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.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

243 kommentarerLämna ett svar

  1. Syed Balkhi

    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

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

    • WPBeginner Support

      You’re welcome, glad we could help!

      Administratör

  3. Scott Baranek

    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. Mark the martian

    Thanks so much for explaining. Was pulling my hair out over this.

    • WPBeginner Support

      Glad our guide was helpful :)

      Administratör

  5. ahmed

    try to delete caches after first solution and it will work

    • WPBeginner Support

      Thanks for sharing your recommendation :)

      Administratör

  6. Deepak kumar

    Due to this tutorial. My issue fix thankyou so much………..

    • WPBeginner Support

      You’re welcome, glad our guide could be helpful :)

      Administratör

  7. Adam

    I was getting the same 404 error and the first solution solved the issue for me.
    Many thanks!

    • WPBeginner Support

      You’re welcome, glad our guide was helpful :)

      Administratör

  8. Binod Raj Joshi

    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!

    • WPBeginner Support

      You’re welcome, glad our guide could help :)

      Administratör

  9. saurab

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

  10. Ashish Sharma

    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

  11. RAJEEV KUMAR

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

  12. seerity

    Thanks, this fixed mine.

  13. Tracy Pope

    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

      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.

      Administratör

  14. Amit

    Hi,

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

    or

    keep the existing code and add your code also?

    Need help.

  15. Keitai

    hmm,

    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?

  16. Carol

    I did the first option and now I have an internal server error!

  17. Tony

    Thanks for listening. I got the solution cheers

  18. Tony

    @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

  19. Tony

    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

  20. nageswarao

    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

  21. Brandon Still

    This worked for me, thank you!!!

  22. Nik

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

  23. Andy Johnston

    Worked for me. Thank you!

  24. Kunal Sarkar

    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.

    Thanks,
    Kunal Sarkar

  25. Shivam

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

  26. Naman Kumar

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

  27. Mohammed Jhosawa

    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.

    Thanks.

    • Alx Diesel

      @Mohammed Your suggestion worked. Thanks a lot.

    • Amar

      Thnks bro this worked for me.

    • Mr. Dif

      This worked for me also although I did implement the .htacess change as well.

    • Mohammed

      Your idea was good and thanks a lot

    • Faisal Sofi

      It worked… Thanks

  28. Felix

    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

    • Pankaj

      Yah This is fixed! Thanks a lot!

    • Christian

      thanks man, this worked.

    • Grant

      Reply to say that this method worked for me. Just go to permalinks page in settings, and click save.

    • Raf

      Awesome!! It worked.

    • Sergey

      Thanx! fixed for me

  29. Deborah

    Thank you so much! Worked like a charm to reduce the number from 1000 to 100.

  30. Tim

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

  31. Arshad

    Thanks Joshua
    Had the same problem. Changing the rows from 1000 to 100 will fixed it for me.

    • Klick

      Thx i have change it too from 1000 to 100 now it work Thanx

    • Ridfay

      Now work with this tips thanx

  32. Miro

    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!

  33. aaron

    I seem to be getting this for my posts. I suspect yoast is deleting my .htaccess file.

  34. Jeremy Vandermeer

    Unchecking and rechecking the XML SItemap option also worked for me. Thanks!

  35. Esteban

    Thank you!

  36. Joe

    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.

  37. Atanas Tanev

    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!

    Cheers!

    Atanas Tanev

    • Nirav Dave

      Hey ATANAS!

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

      Nirav

  38. Bas

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

    • Jay

      Same with me!!!? Have you managed to fix this?

    • Miles O'Brien

      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

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

  39. Henry

    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.

  40. Rami Alloush

    Uncheck then re-check indeed solved that for me.
    Thanks

    • Chris

      LOL This worked for me too. I looked at 25 pages before I saw your comment.

  41. Nikos Kavvadas

    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!

    Thanks!

  42. Henk Valk

    Thanks Joshua
    Had the same problem. Changing the rows from 1000 to 100 will fixed it for me.

  43. Morteza

    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..

  44. TimValDen

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

  45. Joshua Largent

    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

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

  46. onarto

    It looks like htaccess edition disappear since yesterday… nothing in the menu anymore…

  47. Adrienne McCue

    Just checking and unchecking takes care of the issue. I will check this plugin out now! I did so much seo before, but I like so many features here!

  48. David Bell

    I found the same thing as Jane below. Thank you!

  49. smaug

    adding the following code to my .htaccess fixed the sitemap for me:

    https://gist.github.com/jdevalk/5345872

    (note this code is for if your wordpress installation is in a subdirectory named wordpress, if your is in a different folder, change the directory name in the code)

  50. Awais

    i have photography website . Should i uncheck the exclude media option or it’s ok?

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.