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

Come correggere l’errore 404 della sitemap di WordPress SEO di Yoast

Nota editoriale: guadagniamo una commissione dai link dei partner su WPBeginner. Le commissioni non influenzano le opinioni o le valutazioni dei nostri redattori. Per saperne di più su Processo editoriale.

State cercando di correggere l’errore 404 della sitemap di Yoast SEO in WordPress?

Yoast SEO è uno dei plugin SEO più popolari per WordPress. A causa di un conflitto tra i plugin o di impostazioni errate di WordPress, potrebbe mostrare un errore 404 quando si cerca di visitare la sitemap XML.

In questo articolo vi mostreremo come correggere facilmente l’errore 404 della sitemap XML di Yoast SEO in WordPress.

Fixing Yoast SEO XML sitemap 404 error in WordPress

Cosa causa l’errore 404 di Yoast SEO Sitemap in WordPress?

La sitemap di Yoast SEO aiuta i motori di ricerca a trovare tutti i contenuti del vostro sito web che volete che trovino e indicizzino.

Correggendo l’errore si garantisce che i motori di ricerca possano accedere alla sitemap e scoprire tutte le pagine e i contenuti del sito, il che può portare a una migliore visibilità e posizionamento sui motori di ricerca. Questo aiuterà anche a classificare i contenuti più velocemente rispetto a quanto avviene senza una sitemap.

WordPress viene fornito con una sitemap XML predefinita da inviare a Google Search Console e ad altri motori di ricerca.

La sitemap XML può essere visitata inserendo il seguente URL nella barra degli indirizzi del browser.

https://example.com/sitemap.xml

Tuttavia, la sitemap predefinita generata da WordPress è molto semplice. Per correggere questo problema, tutti i plugin SEO WordPress in alto, come All in One SEO for WordPress o il plugin Yoast SEO, creano le proprie sitemap XML con più caratteristiche.

Quando si utilizza la sitemap XML generata dal plugin WordPress SEO, questi plugin riscrivono lo scorciatoia predefinita di WordPress XML sitemap.

Ciò significa che l’URL della sitemap di cui sopra invierà gli utenti alla sitemap generata dal plugin SEO di WordPress.

Purtroppo, questo può causare un errore 404 su alcuni siti web a causa di conflitti tra plugin o impostazioni errate di WordPress.

Detto questo, vediamo come correggere facilmente l’errore 404 della sitemap di WordPress nel plugin Yoast SEO.

1. Ricarica della struttura dei Permalink di WordPress

WordPress è dotato di una struttura di URL orientata alla SEO (chiamata anche permalink). Questa struttura di URL utilizza un sistema di reindirizzamento per indicare al server di hosting web quale pagina caricare quando un utente inserisce un URL nel browser.

Di norma, le impostazioni dei permalink vengono aggiornate automaticamente quando si apportano modifiche al sito web.

Tuttavia, a volte WordPress potrebbe non essere in grado di ricaricare la struttura dei permalink, causando la comparsa dell’errore 404 della sitemap di Yoast SEO.

Questo problema può essere facilmente corretto visitando la pagina Impostazioni ” Permalinks nell’area di amministrazione di WordPress e facendo clic sul pulsante “Salva modifiche”.

Update permalinks

In questo modo si ricaricano le impostazioni dei permalink di WordPress. Ora è possibile visitare la pagina della sitemap XML per verificare se il problema è stato corretto.

Se il problema non è stato corretto, potete continuare a leggere.

2. Aggiornamento manuale dei permalink

Se la ricarica della struttura dei permalink di WordPress non corregge l’errore 404, è possibile indicare manualmente al server web di reindirizzare gli utenti alla pagina della sitemap di Yoast SEO.

A tal fine, è necessario aggiungere il seguente codice al file .htaccess.

# 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

Nota: se il vostro sito web WordPress è installato in una sottodirectory o cartella (ad esempio https://example.com/mywebsite/ ), dovrete utilizzare il seguente codice.

# 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

Non dimenticate di sostituire /mywebsite/ con il nome della vostra sottodirectory.

Questo codice indica semplicemente al vostro server quali pagine visualizzare quando gli utenti accedono alle sitemap XML di Yoast SEO.

Ora si può provare a visualizzare la sitemap XML per vedere se il problema si corregge.

3. Passare a un plugin XML Sitemaps

Se i metodi sopra descritti non hanno risolto l’errore 404 sulla pagina della sitemap XML di Yoast SEO, si può provare a utilizzare un plugin separato per generare sitemap XML per il sito web.

Lo svantaggio di questo approccio è che dovrete affidarvi a un plugin separato per generare sitemap XML e a Yoast SEO per altre caratteristiche SEO.

Per prima cosa, è necessario installare e attivare il plugin XML Sitemaps. Per maggiori dettagli, consultate la nostra guida passo-passo su come installare un plugin di WordPress.

Dato che si utilizza Yoast SEO, verrà mostrata automaticamente una notifica per disabilitare il plugin XML Sitemaps o la funzionalità sitemap di Yoast SEO.

Yoast SEO XML Sitemap conflict warning

Fare clic sul pulsante Attiva/disattiva la Sitemap XML di Yoast SEO per continuare.

Si accede così alla scheda Caratteristiche della pagina SEO ” Generale”. Da qui è necessario scorrere verso il basso fino all’opzione XML Sitemaps e disattivarla.

Disabling XML sitemaps in Yoast SEO

Non dimenticate di fare clic sul pulsante “Salva modifiche” per salvare le impostazioni.

Ora è possibile passare alla pagina Impostazioni ” XML-Sitemap per configurare le sitemap. Per la maggior parte dei siti web, le impostazioni predefinite funzionano subito.

XML Sitemaps settings

Ma è sempre possibile configurare le impostazioni in base alle proprie esigenze.

Ora è possibile inviare l’URL della sitemap XML alla Search Console di Google e ad altri motori di ricerca.

Sitemap URL

4. Passare a Tutto-in-uno SEO per WordPress

Se tutti i passaggi per la risoluzione dei problemi falliscono e non si desidera utilizzare un plugin separato per generare sitemap XML, questo metodo può aiutare a correggere l’errore 404 della sitemap.

Per questo metodo, avrete bisogno di All in One SEO per WordPress. Si tratta del miglior plugin SEO per WordPress presente sul mercato e di un’alternativa molto migliore a Yoast SEO.

Per maggiori dettagli sulle differenze, potete consultare il nostro confronto Yoast vs All in One SEO.

All in One SEO (AIOSEO) è dotato di sitemap XML avanzate con opzioni facili da gestire che consentono di avere il pieno controllo su cosa includere o escludere dalle sitemap XML.

Per prima cosa, è necessario installare e attivare il plugin All in One SEO for WordPress. Per maggiori dettagli, consultate la nostra guida passo-passo su come installare un plugin per WordPress.

Nota: esiste anche una versione gratuita di All in One SEO per WordPress, che include la maggior parte delle caratteristiche delle sitemap XML, ad eccezione di quelle relative a video e notizie.

Dopo l’attivazione, il plugin vi guiderà attraverso una configurazione guidata. Se avete bisogno di aiuto durante la configurazione, potete seguire la nostra guida su come configurare correttamente il plugin All in One SEO per WordPress.

All in One SEO setup

All in One SEO vi permetterà anche di importare i dati SEO da Yoast SEO.

Questo assicura che tutti i meta tag e i titoli SEO precedenti rimangano invariati.

Import Yoast SEO data

Dopo la configurazione iniziale, si può andare alla pagina All in One SEO ” Sitemaps per configurare le impostazioni della sitemap XML.

All in One SEO sitemaps settings

Fate clic sul pulsante Apri Sitemap per verificare se è stato corretto l’errore 404 della sitemap di WordPress.

Successivamente, si configurano le impostazioni della sitemap, se necessario.

Per esempio, All in One SEO consente di scegliere cosa includere nelle sitemap. È possibile aggiungere o rimuovere post type, tassonomie, singoli articoli e pagine.

All in One SEO sitemaps advanced settings

Tutto-in-uno SEO permette anche di creare video, notizie, sitemap RSS e sitemap HTML per il vostro sito web.

Additional sitemaps

Queste sitemap possono anche essere inviate a Google Search Console e ad altri motori di ricerca. Questo aiuta i motori di ricerca a trovare rapidamente i nuovi contenuti del sito web.

Speriamo che questo articolo vi abbia aiutato a correggere l’errore 404 di Yoast SEO Sitemap in WordPress. Potreste anche voler consultare la nostra guida completa alla risoluzione dei problemi di WordPress o vedere come correggere gli errori più comuni di WordPress.

Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e Facebook.

Divulgazione: I nostri contenuti sono sostenuti dai lettori. Ciò significa che se cliccate su alcuni dei nostri link, potremmo guadagnare una commissione. Vedi come WPBeginner è finanziato , perché è importante e come puoi sostenerci. Ecco il nostro processo editoriale .

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.

Il kit di strumenti WordPress definitivo

Ottenete l'accesso gratuito al nostro kit di strumenti - una raccolta di prodotti e risorse relative a WordPress che ogni professionista dovrebbe avere!

Reader Interactions

243 commentiLascia una risposta

  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

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

      Admin

  9. Amit says

    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.

  10. Keitai says

    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?

  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.

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

    Thanks.

  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!

    Cheers!

    Atanas Tanev

  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!

    Thanks!

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

Lascia una risposta

Grazie per aver scelto di lasciare un commento. Tenga presente che tutti i commenti sono moderati in base alle nostre politica dei commenti e il suo indirizzo e-mail NON sarà pubblicato. Si prega di NON utilizzare parole chiave nel campo del nome. Avremo una conversazione personale e significativa.