2013-04-23 86 views
0

/家庭/ my_home /的public_html只保护一个文件夹中的Apache与密码

AuthName "message" 
AuthType Basic 
AuthUserFile /home/my_home/.htpasswd 
require valid-user 

但这保护了我的所有网站,同时我想保护/ home/my_home/public_html/admin。在我的错误日志中,我看到:

/home/myhome/public_html/admin/.htaccess: <Directory not allowed here 
+0

尝试[this](http://www.addedbytes.com/blog/code/password-protect-a-directory-with-htaccess/) – 2013-04-23 12:05:24

+0

将文件放在/ home/my_home/public_html/admin不/家/ my_home/public_html – ElSinus 2013-04-23 12:05:32

+0

没有工作.....保护整个网站。我也将该文件移动到另一个文件,但没有结果 – francis 2013-04-23 12:10:35

回答

0

您必须将.htaccess文件放入管理文件夹。

在.htaccess文件中找到的配置指令应用于找到.htaccess文件的目录及其所有子目录。请参阅Apache documentation

+0

是的,我知道,但没有工作。我有我的管理文件夹内的这些指令.htaccess ...但没有任何 – francis 2013-04-23 12:18:39

+0

请确保,你已经删除/ home/my_home/public_html文件夹中的.htaccess文件,并且admin文件夹中的.htaccess文件命名正确。通常人们忘记了文件名前面的点。此外浏览器重新启动或页面重新加载可以帮助(strg + f5在Firefox上) – Alexxus 2013-04-23 12:30:54

+0

我必须在public_html中删除我的htacces? – francis 2013-04-23 12:59:30