0

This my path: http://172.21.4.100/bluescope_app/index.php?page=creer_contact_client

I have two files:

1st: .htpasswd holds only:

dave:***password***

2nd: .htaccess holds:

AuthType Basic
AuthUserFile /172.21.4.100/bluescope_app/dave/.htpasswd  //<---- I'm stuck here, is this correct ?

AuthName "Enter valid username and password!"

<Files test.php>
    require valid-user
</Files>

On browser I got prompt but I can't access with my password.

If you know the answer Post as much as possible, thank you.

Included path:

http://172.21.4.100/bluescope_app/.htaccess

http://172.21.4.100/bluescope_app/.htpasswd

k6t back
  • 87
  • 1
  • 8

2 Answers2

0

AuthUserFile should include the absolute path not URL

To get the absolute path, you can do this in php :

echo $_SERVER['DOCUMENT_ROOT']; 

It will return something like

/home/user98/www/public_html/

So in that case, since your .htpasswd is in the directory bluescope_app/dave

You should do :

AuthUserFile /home/user98/www/public_html/bluescope_app/dave/.htpasswd

This in an example on linux, if you are on windows it will be almost the same...

Dany Khalife
  • 1,850
  • 3
  • 20
  • 47
0

I got answer , I used Double Quotes then i got ,,

AuthUserFile "/var/www/html/bluescope_app/dave/.htpasswd"

thanks for your idea (use absolute path)@Dany Khalife

k6t back
  • 87
  • 1
  • 8