I'm using URL rewriting on my website and i would like to add an authentication via .htpasswd file to one of my directory.
My website is build like that
/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
On /home/website/ directory i got a .htaccess file :
RewriteRule ^directory([0-9]+)/protected/([a-z0-9-_]+).php /home/website/protected/admin.php?d=$1&p=$2 [QSA]
Using url like
http//website/directory1/protected/test.php
you will call
/home/website/1/protected/admin.php?d=1&p=test
On .htaccess from /protected/ directory i got :
AuthName "Page d'administration protégée"
AuthType Basic
AuthUserFile "/home/website/protected/.htpasswd"
Require valid-user
And on .htpasswd from /protected/ directory i got :
admin:crypted_password
But my problem is that, when i call
http//website/directory1/protected/test.php
i never got the authentication windows, any idea to fix this?