2017-10-16 133 views
0

我想用http密碼保護protect-me-dir目錄。我想這樣的代碼:只使用htpasswd保護目錄

AuthType Basic 
AuthName "restricted area" 
AuthUserFile /home/iterator/public_html/protect-me-dir/.htpasswd 
require valid-user 

它的工作原理,但不幸的是它要求輸入密碼無處不在,不僅在protect-me-dir。如何才能保護只有那個目錄?

如果我把這個代碼中<Directory "/home/iterator/public_html/protect-me-dir">...</Directory>,我得到內部服務器錯誤

回答

1

只要把.htaccess文件你想用密碼保護的目錄。它是一個每個目錄的配置文件。