我在我的網站上使用URL重寫,我想通過.htpasswd文件添加一個身份驗證到我的目錄之一。URL重寫和htpasswd
我的網站是建立這樣
/home/website/
/home/website/protected/
/home/website/protected/.htaccess
/home/website/protected/.htpasswd
/home/website/protected/admin.php
/home/website/.htaccess
/home/website/index.php
/home/website/index_protected.php
開/家/網站/目錄我有一個.htaccess文件:
RewriteRule ^directory([0-9]+)/protected/([a-z0-9-_]+).php /home/website/protected/admin.php?d=$1&p=$2 [QSA]
使用URL像
http//website/directory1/protected/test.php
你會致電
/home/website/1/protected/admin.php?d=1&p=test
在從/保護/目錄下,我得到的.htaccess:
AuthName "Page d'administration protégée"
AuthType Basic
AuthUserFile "/home/website/protected/.htpasswd"
Require valid-user
以及從/保護/目錄下,我得到htpasswd的:
admin:crypted_password
但我的問題是,當我打電話
http//website/directory1/protected/test.php
我從來沒有認證窗口,任何想法來解決這個問題?
也許我不明白,但在我的/保護/目錄我已經得到。「基本認證」指令.htaccess文件 – Natha
對不起,當然,我發現它在你的問題。 –
Np,感謝嘗試幫助我 – Natha