jus*_*inl 92 .htaccess password-protection subdirectory
我有密码保护我的整个网站使用,.htaccess但我想公开其中一个子目录,以便无需密码即可查看.
如何禁用子目录的htaccess密码保护?具体是什么.htaccess语法.
这是我的.htaccess文件放在我的ftp的根目录中.
AuthName "Site Administratrion" AuthUserFile /dir/.htpasswd AuthGroupFile /dev/null AuthName secure AuthType Basic require user username1 order allow,deny allow from all
Rag*_*geZ 146
您需要.htaccess在所需目录中创建一个新文件,并Satisfy any在其中包含该指令,对于Apache 2.3:
# allows any user to see this directory
Satisfy Any
Run Code Online (Sandbox Code Playgroud)
在Apache 2.4中更改了语法,这具有相同的效果:
Require all granted
Run Code Online (Sandbox Code Playgroud)
ato*_*nyc 34
添加到RageZ的答案,我在服务器指令中使用了这个:
<Directory /var/www/protected/>
AuthType Basic
AuthName "Production"
AuthUserFile /path/to/.htpasswd
Require valid-user
</Directory>
<Directory /var/www/protected/unprotected>
Satisfy Any
</Directory>
Run Code Online (Sandbox Code Playgroud)
真棒.谢谢RageZ!
只需.htaccess使用以下指令在所需的子目录中创建一个新的:
Allow from all
您只能使用以下内容限制您的IP:
Allow from x.x.x.x
请参阅:http://httpd.apache.org/docs/current/mod/mod_access_compat.html
| 归档时间: |
|
| 查看次数: |
82958 次 |
| 最近记录: |