1

My site is running on the server .I want to make it password protected by using htacess but i am confused about the htacess file location

3
  1. /var/www/projectname/.htaccess
### password protected ###
AuthName "Protected page"
AuthType Basic
AuthUserFile "/var/www/projectname/.htpasswd"
Require valid-user
  1. /var/www/projectname/.htpasswd
usman:$apr1$zUikaL6j$5GClp9ADKHm8/uuhph3BI1

Note :

usman:$apr1$zUikaL6j$5GClp9ADKHm8/uuhph3BI1 = usman:usman
  |               |
username       password
|improve this answer|||||
  • it gives me 500 internal server error – usman Jan 15 at 20:50
  • when i check var/log/apache2/error.log it gave me an error of [Thu Jan 16 01:51:17.608694 2020] [authn_file:error] [pid 14977] (2)No such file or directory: [client 127.0.0.1:37804] AH01620: Could not open password file: /var/www/html/myproject.htpasswd – usman Jan 15 at 20:52
  • In AuthUserFile "/var/www/projectname/.htpasswd" you replace projectname by your Real project name – PЯINCƏ Jan 15 at 20:54
  • Thanks a lot my issue is resolved .i only want to know how u incrept password? – usman Jan 15 at 20:57
  • 1
    Thanku so much .you save my day – usman Jan 15 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.