• Saltar a la navegación principal
  • Saltar al contenido principal
  • Saltar al pie de página
labarta

Labarta

  • Plugins WordPress
    • Plugins Premium
    • Plugins gratuitos
    • Preguntas frecuentes
  • Quién soy
  • Contáctame
  • Blog
  • Ayuda

Proteger la carpeta "Uploads" en WordPress

13/11/2018

labarta-intranet-22

Proteger la carpeta "Uploads" en WordPress

Después de crear un sitio web de documentación que solo pudieran ver los usuarios registrados y cada uno de ellos solo sus propios documentos (excepto el administrador) y con acceso a la web a través de una intranet.

labarta-intranet-1

Vemos que va todo perfecto, clasificado en carpetas y cada usuario solo ve lo que el ha subido. 

Pero no es así....

Resulta que cualquier persona desde el navegador puede ver todos los documentos libremente: 

https://tudominio.com/wp-content/uploads/

Prueba con tu dominio, según los plugins que tengas instalados o bien según el hosting puede que ya estés protegido.

labarta-intranet-4

O sea que tiene acceso a todo: imágenes, documentos pdf, etc. 

¿Cómo proteger la carpeta Uploads en WordPress?

Empezaremos por proteger el archivo .htaccess.

Para proteger tu  .htaccess , el archivo  wp-config.php y la navegación en carpetas,  añade todo este código en tu  .htaccess : 


# Proteger el archivo .htaccess
<files .htaccess>
Order Allow,Deny
Deny from all
</files>
# Proteger el archivo wp-config.php
<files wp-config.php>
Order Allow,Deny
Deny from all
</files>
# Proteger la navegación de carpetas
Options All -Indexes

Después para bloquear la navegación de la carpeta "Uploads" añades esto a un nuevo archivo .htaccess y colocas este nuevo archivo dentro del directorio de Uploads.

# Bloquear la navegación de la carpeta de Uploads y dar seguridad de subida de archivos
<Files ~ ".*\..*">
Order Allow,Deny
Deny from all
</Files>
<FilesMatch "\.(jpg|jpeg|jpe|gif|png|bmp|tif|tiff|doc|pdf|rtf|xls|numbers|odt|pages|key|zip|rar)$">
Order Deny,Allow
Allow from all
</FilesMatch>

Puedes eliminar o añadir extensiones según precises para asegurarte de que solo se puedan usar estas extensiones en esta carpeta.

Vamos a ver los resultados:

labarta-intranet-22

labarta-intranet-23

labarta-intranet-24

Perfecto ahora ya no pueden navegar por las carpetas.

Espero que esto te sirva, esa es mi intención al hacer este artículo.

PD- Otra muy buena opción (si el plugin que usamos lo permite) es subir los archivos a Google Drive, Dropbox, OneDrive etc. así además evitamos sobrecargar de megabytes nuestro servidor.


Si te ha gustado este artículo, por favor, comparte - Gracias -


Blog,  Seguridad WP

  • Todas las entradas
  • Vídeos Docker
  • Meetup WordPress
  • Vídeos Plugins
  • Vídeos entrevistas
  • Dominios
  • Hosting
  • Avisos Legales
  • Política de privacidad
  • Política de cookies

Footer

SWHOSTING - Cloud server

swhosting-vps

GeneratePress - Tema WordPress

GeneratePress

OnlyOffice - Online Office

Usamos ONLYOFFICE Online Office

Ayuda a mantener el blog:

Si te sirven de ayuda los artículos que publico en el blog, de esta forma puedes contribuir a mantener el mismo.

GRACIAS


Copyright © 2023 · Labarta - Powered by : Labarta

Usamos cookies en nuestro sitio web para brindarle la experiencia más relevante recordando sus preferencias y visitas repetidas. Al hacer clic en “Aceptar todo”, acepta el uso de todas las cookies. Sin embargo, puede visitar "Configuración cookies" para proporcionar un consentimiento controlado.
Configuración cookiesAceptar todo
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Siempre activado
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDuraciónDescripción
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
GUARDAR Y ACEPTAR