Versuchen Sie, den 404-Fehler der Yoast SEO-Sitemap in WordPress zu beheben?
Yoast SEO ist eines der beliebtesten SEO-Plugins für WordPress. Aufgrund eines Plugin-Konflikts oder falscher WordPress-Einstellungen kann es einen 404-Fehler anzeigen, wenn Sie versuchen, Ihre XML-Sitemap aufzurufen.
In diesem Artikel zeigen wir Ihnen, wie Sie den Yoast SEO XML-Sitemap 404-Fehler in WordPress leicht beheben können.
Was ist die Ursache Yoast SEO Sitemap 404 Fehler in WordPress?
Die Yoast SEO-Sitemap hilft Suchmaschinen, alle Inhalte auf Ihrer Website zu finden, die sie finden und indizieren sollen.
Durch die Behebung des Fehlers wird sichergestellt, dass Suchmaschinen auf Ihre Sitemap zugreifen und alle Seiten und Inhalte Ihrer Website entdecken können, was zu einer besseren Sichtbarkeit und Platzierung in Suchmaschinen führen kann. Dies wird auch dazu beitragen, dass Ihre Inhalte schneller gefunden werden als ohne eine Sitemap.
WordPress wird mit einer Standard-XML-Sitemap geliefert, die Sie an Google Search Console und andere Suchmaschinen übermitteln können.
Diese XML-Sitemap können Sie aufrufen, indem Sie die folgende URL in die Adresszeile Ihres Browsers eingeben.
https://example.com/sitemap.xml
Diese standardmäßig von WordPress erstellte Sitemap ist jedoch sehr einfach. Um dies zu beheben, erstellen alle Top-WordPress-SEO-Plugins wie All in One SEO für WordPress oder das Yoast SEO-Plugin ihre eigenen XML-Sitemaps mit mehr Funktionen.
Wenn Sie die von Ihrem WordPress-SEO-Plugin erstellte XML-Sitemap verwenden, schreiben diese Plugins die standardmäßige WordPress-XML-Sitemap-Verknüpfung um.
Das bedeutet, dass die oben erwähnte Sitemap-URL die Nutzer nun zu den von Ihrem WordPress-SEO-Plugin generierten Sitemaps leitet.
Leider kann dies auf manchen Websites aufgrund von Plugin-Konflikten oder falschen WordPress-Einstellungen zu einem 404-Fehler führen.
Schauen wir uns also an, wie man den WordPress-Sitemap-404-Fehler mit dem Yoast SEO-Plugin leicht beheben kann.
1. WordPress Permalink-Struktur aktualisieren
WordPress verfügt über eine SEO-freundliche URL-Struktur (auch Permalinks genannt). Diese URL-Struktur verwendet ein Umleitungssystem, um Ihrem Webhosting-Server mitzuteilen, welche Seite geladen werden soll, wenn ein Benutzer eine URL in seinen Browser eingibt.
Normalerweise werden diese Permalinks-Einstellungen automatisch aktualisiert, wenn Sie Änderungen an Ihrer Website vornehmen.
Manchmal ist WordPress jedoch nicht in der Lage, die Permalink-Struktur zu aktualisieren, was dazu führen kann, dass der 404-Fehler der Yoast SEO-Sitemap erscheint.
Dies kann leicht behoben werden, indem Sie die Seite Einstellungen “ Permalinks im WordPress-Administrationsbereich aufrufen und einfach auf die Schaltfläche „Änderungen speichern“ klicken.
Dadurch werden die WordPress-Permalink-Einstellungen aktualisiert. Sie können nun Ihre XML-Sitemap-Seite besuchen, um zu sehen, ob Ihr Problem dadurch behoben wurde.
Wenn das Problem dadurch nicht behoben wurde, können Sie weiter lesen.
2. Permalinks manuell aktualisieren
Wenn die Aktualisierung Ihrer WordPress-Permalink-Struktur den 404-Fehler nicht behebt, können Sie Ihren Webserver manuell anweisen, die Benutzer auf die Sitemap-Seite von Yoast SEO umzuleiten.
Dazu müssen Sie den folgenden Code in Ihre .htaccess-Datei einfügen.
# 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
Hinweis: Wenn Ihre WordPress-Website in einem Unterverzeichnis oder Ordner (z. B. https://example. com/mywebsite/
) installiert ist, müssen Sie den folgenden Code verwenden.
# 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
Vergessen Sie nicht, /mywebsite/ durch den Namen Ihres Unterverzeichnisses zu ersetzen.
Dieser Code teilt Ihrem Webserver einfach mit, welche Seiten angezeigt werden sollen, wenn Benutzer auf die XML-Sitemaps von Yoast SEO zugreifen.
Sie können nun versuchen, Ihre XML-Sitemap anzuzeigen, um zu sehen, ob Ihr Problem dadurch gelöst wird.
3. Wechseln Sie zu einem XML-Sitemap-Plugin
Wenn die oben genannten Methoden den 404-Fehler auf der XML-Sitemap-Seite von Yoast SEO nicht gelöst haben, können Sie versuchen, ein separates Plugin zu verwenden, um XML-Sitemaps für Ihre Website zu erstellen.
Der Nachteil dieses Ansatzes ist, dass Sie sich auf ein separates Plugin zur Erstellung von XML-Sitemaps und Yoast SEO für andere SEO-Funktionen verlassen müssen.
Zunächst müssen Sie das XML-Sitemaps-Plugin installieren und aktivieren. Weitere Einzelheiten finden Sie in unserer Schritt-für-Schritt-Anleitung für die Installation eines WordPress-Plugins.
Da Sie Yoast SEO verwenden, wird Ihnen automatisch eine Benachrichtigung angezeigt, mit der Sie entweder das XML-Sitemap-Plugin oder die Sitemap-Funktion von Yoast SEO deaktivieren können.
Klicken Sie auf die Schaltfläche Toggle Yoast SEO’s XML Sitemap, um fortzufahren.
Dadurch gelangen Sie auf die Registerkarte Funktionen auf der Seite SEO “ Allgemein. Hier müssen Sie nach unten zur Option XML-Sitemaps scrollen und sie ausschalten.
Vergessen Sie nicht, auf die Schaltfläche „Änderungen speichern“ zu klicken, um Ihre Einstellungen zu speichern.
Sie können nun auf die Seite Einstellungen “ XML-Sitemap wechseln, um Ihre Sitemaps zu konfigurieren. Für die meisten Websites funktionieren die Standardeinstellungen sofort.
Sie können die Einstellungen jedoch jederzeit nach Ihren Bedürfnissen konfigurieren.
Sie können nun die XML-Sitemap-URL an die Google-Suchkonsole und andere Suchmaschinen übermitteln.
4. Wechseln Sie zum All in One SEO für WordPress
Wenn alle Schritte zur Fehlerbehebung fehlschlagen und Sie kein separates Plugin zur Generierung von XML-Sitemaps verwenden möchten, kann Ihnen diese Methode helfen, das Sitemap-404-Fehlerproblem zu beheben.
Für diese Methode benötigen Sie All in One SEO für WordPress. Es ist das beste WordPress SEO-Plugin auf dem Markt und eine viel bessere Alternative zu Yoast SEO.
In unserem Vergleich zwischen Yoast und All in One SEO finden Sie weitere Details zu den Unterschieden.
All in One SEO (AIOSEO) verfügt über fortschrittliche XML-Sitemaps mit einfach zu verwaltenden Optionen, die Ihnen die volle Kontrolle darüber geben, was Sie in Ihre XML-Sitemaps aufnehmen oder ausschließen möchten.
Zunächst müssen Sie das All in One SEO für WordPress-Plugin installieren und aktivieren. Weitere Details finden Sie in unserer Schritt-für-Schritt-Anleitung für die Installation eines WordPress-Plugins.
Hinweis: Es gibt auch eine kostenlose Version von All in One SEO für WordPress, die die meisten XML-Sitemap-Funktionen mit Ausnahme von Video- und News-Sitemaps enthält.
Nach der Aktivierung wird das Plugin Sie durch einen Einrichtungsassistenten führen. Wenn Sie während der Einrichtung Hilfe benötigen, können Sie unserer Anleitung zur korrekten Einrichtung des All in One SEO-Plugins für WordPress folgen.
All in One SEO ermöglicht Ihnen auch den Import von SEO-Daten aus Yoast SEO.
Dadurch wird sichergestellt, dass alle Ihre bisherigen SEO-Meta-Tags und Titel unverändert bleiben.
Nach der Ersteinrichtung können Sie auf die Seite All in One SEO “ Sitemaps gehen, um die XML-Sitemap-Einstellungen zu konfigurieren.
Sie können auf die Schaltfläche Sitemap öffnen klicken, um zu sehen, ob der 404-Fehler der Sitemap in WordPress behoben wurde.
Danach konfigurieren Sie die Sitemap-Einstellungen, falls erforderlich.
Bei All in One SEO können Sie zum Beispiel auswählen, was in Ihre Sitemaps aufgenommen werden soll. Sie können Beitragstypen, Taxonomien, einzelne Beiträge und Seiten hinzufügen oder entfernen.
Mit All in One SEO können Sie auch Videos, Nachrichten, RSS-Sitemap und HTML-Sitemap für Ihre Website erstellen.
Diese Sitemaps können auch an die Google Search Console und andere Suchmaschinen übermittelt werden. So können Suchmaschinen neuere Inhalte auf Ihrer Website schnell finden.
Wir hoffen, dass dieser Artikel Ihnen geholfen hat, den Yoast SEO Sitemap 404-Fehler in WordPress zu beheben. Vielleicht möchten Sie auch unseren vollständigen WordPress-Leitfaden zur Fehlerbehebung lesen oder sehen, wie Sie häufige WordPress-Fehler beheben.
Wenn Ihnen dieser Artikel gefallen hat, dann abonnieren Sie bitte unseren YouTube-Kanal für WordPress-Videotutorials. Sie können uns auch auf Twitter und Facebook finden.
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!
CB says
Hi, just tried the second version editing the plug ins core files and the site has disapeared?? including the backend. just a white screen?? I replaced the code withy the original and nothing.
Matt Crystal says
Thank you! That worked by supplying the code in the .htaccess file, then unchecking the site map option and saving. Then, re-checking the box and saving again. Thanks!
Roderick van Straten says
Added this code to the .htaccess and unchecked and checked it, but I only get a blank page now for the sitemap ..
mandingo345 says
yes, without fix, just uncheck save recheck and saved.
Tidus Ha says
the last update work perfect for me. thank you.
Jack says
After loosing quite some time trying to find what was wrong, I got it working by your suggestion „Uncheck the sitemap option in the Yoast’s SEO plugin and ’save‘ settings. After that re-checking the sitemap’s option fixes the error.“
tnx very much!
johnny says
Thank you so much! unchecking, saving, rechecking saving did the trick!
sc456a says
After I added the code to htaccess and unchecked/rechecked Sitemap in the plugin, it worked! Thanks!
Taylor says
Worked!! Thank you!
alireza says
it work for me too, Thanks a lot!
Leo says
Uncheck then save, then go back check again and save, solved my problem. It should be at the begining before anybody try anything else! it worked for me thanks though
Elle Laurel Rose says
Woohoo! Thanks. Mine probably wasn’t broken long because Google didn’t seem to mind yet. … But my site is only in a softer launch stage anyway… Slow crawls maybe. Luckily, I’m improving my site before my real projects go up (hopefully soon).
Anyway I cannot thank you enough.
logitaki says
I opened the class-sitemaps.php file but can’t find the section you are referring to „functiion () init code.. can you be more specific?
Basie says
Editing the .htaccess file, un-checking sitemap generation, saving settings, re-checking, saving settings … fixed it for me! Thank you VERY much.
Tom Atkinson says
I found my issue was actually fixed purely by turning Yoasts sitemaps on and off from UI. Which is great!
Fernando says
Were you able to fix this one? I’m having the same problem, I get a 404 on post-sitemap.xml. I didn’t check the PHP logs on what the error is but probably would be the same you’re getting.
Steve says
No fix, and theres no replies to support threads on wordpress, other people are just disabling it and using another sitemap plugin.
Baidya nath Singh says
It worked with the first code to .htaccess. Thanks.
hayderabbass says
Disabling the XML sitemap and re enabling them fix this issue for me. Thanks!
Ben Billson says
I was having an issue with the sitemap 404’ing when trying to access it.
I tried adding the first ifmodule, no joy, then remembered I had another ifmodule in place to handle redirects after updating my permalink structure.
I removed the redirect ifmodule, restarted Worpress SEO, then the sitemaps started working. Re-added the redirect ifmodule, and everything now appears to be working just fine. I’ve also checked the status in GWT and Bing WT and it’s all looking good. Thanks for the help!
Rob Cooper says
I put the first Ifmodule into htaccess and it spit out some weird single line of content, with no links.
I read through the comments
then I rebooted Yoast’s sitemap option:
i unchecked the „Enable XML Sitemap Here“ and saved
I re-checked it and saved
checked my sitemap and it was there, formatted properly with xsl stylesheet being applied and links all worked
chiappa says
I have no idea where to put that code. There is no line like: „function init()“ in class-sitemaps.php
Katrina Isabelle says
Try going into your permalink settings and saving them again. If you can’t access the back end of your site because of the 500 error, then remove that htaccess file.
Katrina Isabelle says
Hello! I think you should add one more step at the very beginning: Re-save your permalink settings! I found that re-saving my permalink settings solved the issue for me. No need to go into the htaccess file.
EB says
Exactly, solved my problem too.
Alfonso says
this fixed the issue for me, re-saving the WP permalinks
Steve says
I get the following error only on post-sitemap, all other sitemaps work ok:
Fatal error: Allowed memory size../plugins/wordpress-seo/inc/class-sitemaps.php on line 713
I tried the htaccess and wpseo-functions edits but no luck.
I deactivated every plugin, still no luck.
I deleted wpseo and reinstalled but still same problem and now on the wpseo dashboard and sitemaps page I get this error:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‚wpseo_xml_sitemaps_init‘ not found or invalid function name in /home/justplay/public_html/wp/wp-includes/plugin.php on line 470
I have two sites running the same theme, plugins etc and one works ok one has this errors, wierd.
Jane Hockley says
Thank you – i found just by unchecking and saving and then re-checking the site map option for the yoast plugin google webmaster was able to find my site map
eliascan says
Worked for me too. Thanks
Jared Eitnier says
Worked for me as well, good call.
Michael Erickson says
Thanks Jane!
Taylor says
Thank you!! Worked like a charm
Jesse says
This worked for me too. Thanks!
Brent Norris says
yep got rid of the 3 errors displayed in webmaster tools. thanks
Saw Panse says
Worked like a charm. Thanks @janehockley:disqus
Abhishek Mishra says
Guys really you are amazing, yeah AMAZING.. this blog is really helpful for me
Jake Ratliff says
When I tried the htaccess method, it crashed my site. I just added this code into the htaccess file (via the Yoast plugin):
# WordPress SEO – XML Sitemap Rewrite Fix
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
# END WordPress SEO – XML Sitemap Rewrite Fix
And then clicked the „save changes to .htaccess“ button. I can’t go anywhere without the 500 error now. What did I do wrong? Anyone know how to fix this?
Jake Ratliff says
I tried the htaccess fix and now I get a 500 Internal Server Error.
Mark Haller says
@NicolasJoly:disqus you star, well done, thanks so much!
Tiffany Marie McAnally says
So it still doesn’t work for me… I feel like beating my head against a wall. As much as I love the plugin, I think I’m just going to lose it in favor of something that’s actually functional.
Jérôme Lafforgue says
Thanks, work fine in wpseo-functions.php file @ line 461
ast says
for me worked fine!
thank you
NicolasJoly says
@Matt Klein, it’s in the wpseo-functions.php file @ line 461
NicolasJoly says
@Matt Klein, the ‚init‘ function is now ‚wpseo_xml_sitemaps_init‘ in the wpseo-functions.php, @line 461
Add just :
global $wp_rewrite; before the $GLOBALS define
and
$wp_rewrite->flush_rules(); after the add_rewrite_rule…
/**
* Initialize sitemaps. Add sitemap & XSL rewrite rules and query vars
*/
function wpseo_xml_sitemaps_init() {
$options = get_option( ‚wpseo_xml‘ );
if ( $options[‚enablexmlsitemap‘] !== true ) {
return;
}
// redirects sitemap.xml to sitemap_index.xml
add_action( ‚template_redirect‘, ‚wpseo_xml_redirect_sitemap‘, 0 );
if ( ! is_object( $GLOBALS[‚wp‘] ) ) {
return;
}
global $wp_rewrite;
$GLOBALS[‚wp‘]->add_query_var( ’sitemap‘ );
$GLOBALS[‚wp‘]->add_query_var( ’sitemap_n‘ );
$GLOBALS[‚wp‘]->add_query_var( ‚xsl‘ );
add_rewrite_rule( ’sitemap_index.xml$‘, ‚index.php?sitemap=1‘, ‚top‘ );
add_rewrite_rule( ‚([^/]+?)-sitemap([0-9]+)?.xml$‘, ‚index.php?sitemap=$matches[1]&sitemap_n=$matches[2]‘, ‚top‘ );
add_rewrite_rule( ‚([a-z]+)?-?sitemap.xsl$‘, ‚index.php?xsl=$matches[1]‘, ‚top‘ );
$wp_rewrite->flush_rules();
}
Matt Klein says
There is no function init area in my class-sitemaps.php file. Could it be called something else. What line is it on?
Regina Falkowski says
Added the code to .htaccess file and it worked like a charm! Thanks for the fix
Alec Byrne says
Adding the .htaccess worked for me – thanks very much
Desainwebs says
Still not work for me
Ollie says
Htaccess fix worked for me.
But as Scott in the first comment above says, I needed to uncheck the XML sitemap checkbox and save. Then recheck it and save again for the sitemap to show up. I think that would be worth mentioning in the article.
WPBeginner Support says
Ollie, yes we have updated the article.
Admin
Steve Patterson says
Thanks this worked for me editing the .htaccess file. I unchecked sitemaps off then back on and also changed mine from 1,000 to 400. If you are on a shared server, I would use a lower number so that less CPU usage is done on your domain.
scott says
Hi guys,
I had to troubleshoot this issue too. My site is hosted in a sub directory of a main site. So I had to set the following line:
RewriteBase /scottmortiz/
I then had to uncheck the mina Site Map XML option in the plugin, and save. Then re-check the plugin and save. Hope this works for some of you.
-Scott
Chris says
Hi Steven,
thank alot. This helped me, too. But to get the rewrite working I had to disable the xml function, save it, and enable (and save it) again. Seems obvious, but maybe this is worth a note in the article. I will safe this article in my personal wordpress help register.
Thanks,
Chris
Dan says
Thank you Chris! This fixed my 404 problem with Yoast’s XML Sitemap feature.
Jason Judge says
Ah, switch it off, then switch it back on again. Thanks:-) It is not as obvious as you think. My sitemaps also did not work (getting a 404) until I did this. I did not have to make any of the other changes described in this post.
Shanthi Ganesan says
@PEKKO Hi Tried your techniques it really works well,thanks a lot for sharing….
Lukas says
Nothing is working in my case – still Error 404 …
Ryan says
Beauty, fixed it for me too.. thanks for putting this up
lloyd says
this just broke my websites … now getting an internal server error…
Rosie says
The edit to .htaccess files was just the trick. Thanks for posting this! You saved me a whole lot of time and trouble.
Pekko says
I was just facing the same issue. i unticked the box (Check this box to enable XML sitemap functionality) — pressed save, and then ticked the box again, after that It found the sitemap again, Hope it will be there!
Anisa says
I use this technique, and it worked
John says
This worked for me, as well. Thx!
Cara Sherlock says
Unchecking, saving and then rechecking worked for me too. Thx!
Badprimer says
[..unticked the box (Check this box to enable XML sitemap functionality) — pressed save, and then ticked the box again..]
Worked for me. Thx!!
Kerry says
Thank you! Worked for me too! So simple. The author of this article should add this too.
bruce says
This also worked for me. turn off sitemaps. save. turn them back on. save. fixed
David says
Same for me, unchecked, saved, checked, saved, voila!
hobbsy says
this worked for me too
Hugo says
Hi,
I’m still having some troubles with my website:
My site map contains a lot of files like this one:
http://www.blenheimgang.com/wp-content/uploads/media/2013/09/BCRR-E30-25.jpg
and they refer to a broken link. How can I delete them?
WPBeginner Support says
Doesn’t look like a broken link.
Admin
Steven says
I’ll just share what worked for me, by changing the ‚max entries per site map‘ to 250 (ie. something less than 1000) I managed to fix the 404 error. I think the server was having issues processing 1000 entries which is the default.
Maggie says
Hi Steven, this is great solution! I just fixed the problem by your method. Thank you very much!
PromInc says
Thanks Steven – this resolved my issue as well. The ‚max entries…‘ field was blank for me; simply adding any value seemed to work, which is good as I felt 250 was a bit low. Very simple but effective solution.
Nick Root says
That worked thanks for the tip!