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 desactivar la navegación por directorios en WordPress

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.

¿Desea desactivar la navegación por directorios en WordPress?

La navegación por directorios puede poner en peligro su sitio al mostrar información importante a piratas informáticos que pueden utilizarla para explotar vulnerabilidades en los plugins, temas o incluso en el servidor de alojamiento de su sitio.

En este artículo, le mostraremos cómo puede desactivar la navegación por directorios en WordPress.

How to disable directory browsing in WordPress

¿Qué hace desactivar la navegación por directorios en WordPress?

Cada vez que alguien visita su sitio web, su servidor web procesa esa solicitud.

Normalmente, el servidor entrega un archivo de índice al navegador del visitante, como index.html. Sin embargo, si el servidor no puede encontrar un archivo de índice, entonces puede mostrar todos los archivos y carpetas en el directorio solicitado en su lugar.

Se trata de la navegación por directorios, y suele estar activada por defecto.

Si alguna vez has visitado un sitio y has visto una lista de archivos y carpetas en lugar de una página web, entonces has visto la navegación por directorios en acción.

A WordPress site with directory browsing enabled

El problema es que los piratas informáticos pueden utilizar la exploración de directorios para ver los archivos que componen su sitio web, incluidos todos los temas y plugins que esté utilizando.

Si alguno de estos temas o plugins tiene vulnerabilidades conocidas, los piratas informáticos pueden utilizar este conocimiento para tomar el control de su blog o sitio web de WordPress, robar sus datos o realizar otras acciones.

Los atacantes también pueden utilizar la exploración de directorios para ver la información confidencial dentro de sus archivos y carpetas. Incluso podrían copiar el contenido de su sitio web, incluido el contenido por el que normalmente cobraría, como descargas de libros electrónicos o cursos en línea.

Por eso se considera una buena práctica desactivar la navegación por directorios en WordPress.

Cómo marcar / comprobar si la navegación por directorios está activada en WordPress

La forma más sencilla de comprobar si la navegación por directorios está activada en su sitio web de WordPress es simplemente enlazando la carpeta /wp-includes/ de la siguiente manera: https://example.com/wp-includes/.

Sustituya www.example.com por la URL de su sitio web.

Si recibe un mensaje 403 Forbidden o similar, entonces la navegación por directorios ya está desactivada en su sitio web WordPress.

A website with directory browsing disabled

Si en cambio ve un anuncio / catálogo / ficha, significa que la navegación por directorios está activada / activada para su sitio web.

A WordPress site with directory browsing enabled

Dado que esto hace que su sitio web sea más vulnerable a los ataques, normalmente querrá bloquear la navegación por directorios en WordPress.

Cómo desactivar la navegación por directorios en WordPress

Para desactivar el anuncio / catálogo / ficha, deberá añadir código al archivo .htaccess de su sitio.

Para acceder al archivo, necesitará un cliente FTP o puede utilizar la aplicación de gestión de archivos del panel de control de su alojamiento WordPress.

Si es la primera vez que utiliza FTP, puede consultar nuestra guía completa sobre cómo conectarse a su sitio utilizando FTP.

Tras conectarte a tu sitio, abre la carpeta “pública” de tu sitio web y busca el archivo .htaccess. Puede editar el archivo .htaccess descargándolo en su escritorio y abriéndolo en un editor de texto como el Bloc de notas.

En la parte inferior del archivo, añada el siguiente código:

Options -Indexes

Será algo parecido a esto:

The WordPress .htaccess file

Una vez que haya terminado, guarde su archivo .htaccess y vuelva a subirlo a su servidor utilizando un cliente FTP.

Ya está. Ahora, si visita la misma URL http://example.com/wp-includes/, obtendrá un mensaje 403 Forbidden o similar.

How to disable directory browsing in WordPress

Esperamos que este artículo te haya ayudado a aprender cómo desactivar la navegación por directorios en WordPress. Puede que también quieras ver nuestra guía definitiva sobre seguridad en WordPress, o ver nuestra selección experta del mejor plugin de membresía para WordPress para proteger tus archivos.

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

94 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. Jiří Vaněk says

    Thanks for the advice. On directory browsing, or that I have it enabled, the AIO SEO plugin keeps warning me. I have currently solved the problem by making the folders have an index file that is empty. Is it possible to take this as one of the possible solutions?

      • Jiří Vaněk says

        Thanks for the advice, I finally used the Options -Indexes method now and AIO SEO already reports the problem as solved. Thanks again.

  3. Ka Khaliq says

    After editing the htaccess file as per the provided guidelines, I do see 403 Forbidden message for /wp-includes/. But I’m unable to see edit any post. Upon editing a post, I see the same 403 Forbidden message. How to solve this?

  4. Pradip Singh says

    I am in love with this website. Every day I am surprised when I read a new article from this website. Thankfully I read this article today and immediately I implemented the advice.

  5. Jonthan says

    So is it ok to have this code on .htaccess file even when an index.php file is present in the root folder.

    Kindly respond.

  6. michael says

    Hello
    does this action affect pages indexing on search engines?
    and does it make some problems for indexed pages of my WordPress website?
    Thanks

  7. Shams says

    Amazing post,

    Just have simple question, I added this code and it’s working, the question is Google indexes those page e.g sitecom/wp-contents/2019/2, will Google remove those pages automatically now as these are 404. Or I should remove it in Search Console?

    Thanks

  8. Bill says

    Hello!

    I recently applied this rule
    and at the same day the front page of my blog
    got vanished from google index.

    Do you see any connection?

    • WPBeginner Support says

      Adding this to your htaccess should not affect your indexing, there are multiple reasons and you would want to check your Google Search Console for what it says about your home page.

      Administrador

  9. Ionel G says

    Thanks for all the tips that you provide!
    I am still wondering how can you hide the wp-content & wp-include folder from sources? I hate it when someone goes right click and source it can see all of my plugins :). Do you have any script for this?
    Thank you in advance!

    • WPBeginner Support says

      We do not have a recommended method for that at the moment, the most common reason you can’t see those folders in dev tools is a site’s cache.

      Administrador

  10. Mayur says

    Could you please tell me How can i disable WordPress in sub folder like my WordPress install on [www.mydomain.com] and i want to disable wordpress in [www.mydomain.com/customscript]

  11. Deatram says

    I disabled directory browsing, but still someone can see my directory when they use developer tools in chrome browser. How do I disable in that as well?

  12. Nathan says

    When I click “Save Changes” on the Permalink Settings page the .htaccess file is updated, erasing the “Options -Indexes” code that I inputted. The code works fine, but I am concerned I will unknowingly delete it while performing some other task. Are there any other dashboard settings changes that I should know about that may affect the .htaccess file and erase the code? Thanks

  13. Baggio says

    Huge fan of wpbeginner, Optin Monster – I got so many useful tips and tricks on WP – and I have to say, the site design is just brilliant. And of course, the content here is epicly useful.

    Thanks guys!

  14. daniel says

    Hey! It doesnt seem to work. if i pull an image to another page its opened with a link of: example.com/wp-content/uploads/…
    Any idea? thanks!

      • Axel Jebens says

        I would appreciate if you could iterate on this. I had a hard time when trying to get a solution for this issue. There are some ideas based on a htaccess redirecting to a php file that first checks if the user is logged on. Is there any plugin which provides such a function?

  15. Charles says

    I have been writing this same code for weeks now but my directory remains visible to users. Pls what am doing wrong? Or could it be that my site is still loading from cached contents? Everybody says it is working but my own experience is different. Any help will be appreciated! Thanks in anticipation of your reply.

  16. Mike says

    Is there a way to allow viewing a directory but just hide the Parent Directory link for a specific page? This would be a network share folder that multiple people would access, and have sub folders which would still require a parent directory listing. I just don’t want anyone going above the shared folder.

  17. Christian Nastari says

    This didn’t work for me. I tried before and after #END WordPress and didn’t work. I also tried “Options All -Indexes”, but didn’t work either

  18. Anita in SD says

    Thanks so much, was dismayed to see images from my site going to a parent directory :0. This was very helpful and worked well.
    Blessings – A

  19. Heather Jacobsen says

    Thanks for this tutorial. It worked great for hiding my uploads from anyone just wanting to browse that directory. One question, though. Does this by chance turn off the ability of search engines to browse my website. Sorry if it seems like a dumb question. I am a newbie, after all. :)

  20. Wasil Burki says

    I added the Options -Indexes code to the htaccess file, however now I am not able to access the site I get a 503 error. Am I doing something wrong? Need help bad!! Thanks

  21. Ted says

    The problem I have is that I can see the directory of this wordpress site, so if you are using this solution then it doesn’t work… (theme wpbv4)

  22. Rahul says

    Thank you so much for the tutorial!

    I was very concerned when I discovered some of my theme directories could be browsed. All good now, thanks to your tutorial. I never knew .htaccess packed in so much punch.

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.