cyxmedia
9/9/2017 - 6:09 PM

Denegar el acceso a un directorio

Código que nos permitirá poder denegar el acceso a todo el que entre en el directorio donde esté situado este archivo .htaccess.

# DENEGAR EL ACCESO (EXTERNO) A UN DIRECTORIO
<Limit GET>
 Order Deny,Allow
 Deny from all
</Limit>

# Para Apache 2.4 debemos usar lo siguiente:
# Require all denied


# PARA PODER AUTORIZAR SOLAMENTE LAS DIRECCIONES IPs QUE NOSOTROS QUERAMOS, TENEMOS QUE HACERLO CON EL SIGUIENTE CÓDIGO:
<Limit GET>
 Order Deny,Allow
 Deny from all
 Allow from 192.168.1.10 192.168.1.11 
</Limit>

# Para Apache 2.4 debemos usar lo siguiente:
# Require ip xxx.xxx.xxx.xxx


# PARA EL CASO CONTRARIO, ES DECIR, PERMITIR EL ACCESO A TODO EL MUNDO, MENOS A DETERMINADAS IPs EL CÓDIGO SERÍA EL SIGUIENTE:
Order deny, allow
Allow from All
Deny from xxx.xxx.xxx.xxx

# Para Apache 2.4 debemos usar lo siguiente:
# Require not ip xxx.xxx.xxx.xxx