2013-04-23 85 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