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

Cómo corregir el error 404 del mapa del sitio de WordPress SEO de Yoast

Nota editorial: Ganamos una comisión de los enlaces de socios en WPBeginner. Las comisiones no afectan a las opiniones o evaluaciones de nuestros editores. Más información sobre Proceso editorial.

¿Estás intentando corregir el error 404 del mapa del sitio de Yoast SEO en WordPress?

Yoast SEO es uno de los plugins SEO más populares para WordPress. Debido a un conflicto de plugins o ajustes incorrectos de WordPress, puede mostrar un error 404 cuando intenta visitar su mapa del sitio XML.

En este artículo, le mostraremos cómo corregir fácilmente el error 404 del mapa del sitio XML de Yoast SEO en WordPress.

Fixing Yoast SEO XML sitemap 404 error in WordPress

¿Cuál es la causa del error 404 del mapa del sitio de Yoast SEO en WordPress?

El mapa del sitio de Yoast SEO ayuda a los motores de búsqueda a encontrar todo el contenido de su sitio web que desea que encuentren e indexen.

Corregir el error garantiza que los motores de búsqueda puedan acceder a su mapa del sitio y descubrir todas las páginas y contenidos de su sitio, lo que puede mejorar la visibilidad y la clasificación en los motores de búsqueda. Esto también ayudará a clasificar su contenido más rápido que sin un mapa del sitio.

WordPress incluye un mapa del sitio XML por defecto que puede enviar a Google Search Console y a otros motores de búsqueda.

Este mapa del sitio XML puede visitarse introduciendo la siguiente URL en la barra de direcciones de su navegador / explorador.

https://example.com/sitemap.xml

Sin embargo, este mapa del sitio generado por defecto por WordPress es muy básico. Para corregir esto, todos los mejores plugins de SEO para WordPress como All in One SEO para WordPress o el plugin Yoast SEO crean sus propios mapas del sitio XML con más características.

Cuando utiliza el mapa del sitio XML generado por su plugin SEO para WordPress, estos plugins reescriben el atajo del mapa del sitio XML por defecto de WordPress.

Esto significa que la URL del mapa del sitio mencionada anteriormente ahora enviará a los usuarios a los mapas del sitio generados por su plugin SEO para WordPress.

Desafortunadamente, esto puede causar un error 404 en algunos sitios web debido a conflictos entre plugins o ajustes incorrectos de WordPress.

Dicho esto, echemos un vistazo a cómo corregir fácilmente el error 404 del mapa del sitio de WordPress en el plugin Yoast SEO.

1. Actualizar WordPress Enlace permanente Estructura

WordPress viene con una estructura de URL SEO-friendly (también llamada permalinks). Esta estructura de URL utiliza un sistema de redirección para indicar al servidor de alojamiento web qué página debe cargar cuando un usuario introduce una URL en su navegador / explorador.

Normalmente, estos ajustes de enlaces permanentes se actualizan automáticamente cuando realiza cambios en su sitio web.

Sin embargo, a veces WordPress puede no ser capaz de actualizar la estructura de enlaces permanentes, lo que puede provocar que aparezca el error 404 del mapa del sitio de Yoast SEO.

Esto se puede corregir fácilmente visitando la página Ajustes ” Enlaces permanentes en el área de administrador de WordPress y simplemente haciendo clic en el botón “Guardar cambios”.

Update permalinks

Al hacerlo, se actualizarán los ajustes de los enlaces permanentes de WordPress. Ahora puede visitar su página de mapa del sitio XML para ver si esto ha corregido su problema.

Si no se ha corregido el problema, puede seguir leyendo.

2. Actualización manual de Enlaces permanentes

Si al actualizar la estructura de enlaces permanentes de WordPress no se corrige el error 404, puede indicar manualmente a su servidor web que redirija a los usuarios a la página del mapa del sitio de Yoast SEO.

Para ello, deberá añadir el siguiente código a su archivo .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: Si su sitio web WordPress está instalado en un subdirectorio o carpeta (por ejemplo, https://example.com/mywebsite/ ), deberá utilizar el siguiente código.

# 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

No olvide sustituir /miweb/ por el nombre de su subdirectorio.

Este código simplemente indica a su servidor web qué páginas mostrar cuando los usuarios acceden a los mapas del sitio XML de Yoast SEO.

Ahora puede intentar ver su mapa del sitio XML para ver si esto resuelve su problema / conflicto / incidencia.

3. Cambiar a un plugin XML Sitemaps

Si los métodos mencionados anteriormente no solucionaron el error 404 en la página del mapa del sitio XML de Yoast SEO, entonces puede intentar utilizar un plugin independiente para generar mapas del sitio XML para su sitio web.

La desventaja de este enfoque es que usted tendrá que depender de un plugin independiente para generar mapas del sitio XML y Yoast SEO para otras características de SEO.

En primer lugar, debe instalar y activar el plugin XML Sitemaps. Para más detalles, consulte nuestra guía paso a paso sobre cómo instalar un plugin de WordPress.

Como estás usando Yoast SEO, te mostrará automáticamente un aviso para desactivar el plugin XML Sitemaps o la funcionalidad del mapa del sitio de Yoast SEO.

Yoast SEO XML Sitemap conflict warning

Haga clic en el botón Conmutador del mapa del sitio XML de Yoast SEO para continuar.

Esto le llevará a la pestaña Características en la página SEO ” General. Desde aquí, debe desplazarse hasta la opción XML Sitemaps y desactivarla.

Disabling XML sitemaps in Yoast SEO

No olvides hacer clic en el botón “Guardar cambios” para establecer los ajustes.

Ahora puede cambiar a la página Ajustes ” Mapa del sitio XML para configurar sus mapas del sitio. Para la mayoría de los sitios web, los ajustes por defecto funcionarán a la primera.

XML Sitemaps settings

Pero siempre puedes establecer los ajustes en función de tus necesidades.

Ahora puede enviar la URL del mapa del sitio XML a la consola de búsqueda de Google y a otros motores de búsqueda.

Sitemap URL

4. Cambiar a All in One SEO para WordPress

Si todos los pasos para diagnosticar la incidencia fallan y no desea utilizar un plugin independiente para generar mapas del sitio XML, este método puede ayudarle a corregir el problema / conflicto / incidencia del mapa del sitio 404.

Para este método, necesitarás All in One SEO para WordPress. Es el mejor plugin de SEO para WordPress del mercado y una alternativa mucho mejor a Yoast SEO.

Puedes ver nuestra comparativa Yoast vs All in One SEO para más detalles sobre las diferencias.

All in One SEO (AIOSEO) viene con mapas del sitio XML avanzados con opciones fáciles de gestionar que le dan el control total de lo que debe incluir o excluir de sus mapas del sitio XML.

En primer lugar, debe instalar y activar el plugin All in One SEO para WordPress. Para más detalles, consulta nuestra guía paso a paso sobre cómo instalar un plugin de WordPress.

Nota: también existe una versión gratuita de All in One SEO para WordPress, que incluye la mayoría de las características de los mapas del sitio XML, excepto los mapas del sitio de vídeos y noticias.

Una vez activado, el plugin le guiará a través de un asistente de configuración. Puedes seguir nuestra guía sobre cómo establecer correctamente el plugin All in One SEO para WordPress si necesitas ayuda durante la configuración.

All in One SEO setup

All in One SEO también le permitirá importar datos SEO desde Yoast SEO.

Esto garantiza que todas sus anteriores meta etiquetas y títulos SEO permanezcan inalterados.

Import Yoast SEO data

Después de la configuración inicial, puede ir a la página Todo en Uno SEO ” Sitemaps para establecer los ajustes del mapa del sitio XML.

All in One SEO sitemaps settings

Puede hacer clic en el botón Abrir mapa del sitio para ver si se ha corregido el error 404 del mapa del sitio en WordPress.

Después, configure los ajustes del mapa del sitio si es necesario.

Por ejemplo, All in One SEO le permite elegir qué incluir en sus mapas del sitio. Puede añadir o eliminar tipos de contenido, taxonomías, entradas individuales y páginas.

All in One SEO sitemaps advanced settings

All in One SEO también le permite crear vídeos, noticias, mapas del sitio RSS y mapas del sitio HTML para su sitio web.

Additional sitemaps

Estos mapas del sitio también se pueden enviar a Google Search Console y a otros motores de búsqueda. Esto ayuda a los motores de búsqueda a encontrar rápidamente el contenido más reciente de su sitio web.

Esperamos que este artículo te haya ayudado a corregir el error 404 del mapa del sitio de Yoast SEO en WordPress. También puedes consultar nuestra guía completa para diagnosticar problemas en WordPress o ver cómo corregir errores comunes de WordPress.

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.

Descargo: Nuestro contenido está apoyado por los lectores. Esto significa que si hace clic en algunos de nuestros enlaces, podemos ganar una comisión. Vea cómo se financia WPBeginner , por qué es importante, y cómo puede apoyarnos. Aquí está nuestro proceso editorial .

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.

El último kit de herramientas de WordPress

Obtenga acceso GRATUITO a nuestro kit de herramientas - una colección de productos y recursos relacionados con WordPress que todo profesional debería tener!

Reader Interactions

243 comentariosDeja una respuesta

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

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

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

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

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

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

  8. Basie says

    Editing the .htaccess file, un-checking sitemap generation, saving settings, re-checking, saving settings … fixed it for me! Thank you VERY much.

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

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

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

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

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

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

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

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

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

  18. 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();

    }

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

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

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

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

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

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

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

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

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

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

Deja tu comentario

Gracias por elegir dejar un comentario. Tenga en cuenta que todos los comentarios son moderados de acuerdo con nuestros política de comentarios, y su dirección de correo electrónico NO será publicada. Por favor, NO utilice palabras clave en el campo de nombre. Tengamos una conversación personal y significativa.