Advertisement
meetsos

Password Protect File with .htaccess & .htpasswd

Feb 4th, 2021
1,143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. #.htaccess and .htpasswd in the same directory
  2.  
  3. # HTACCESS FILE .htaccess
  4.  
  5. #Protect single file
  6. <Files test.pdf>
  7. AuthName "Dialog prompt"
  8. AuthType Basic
  9. AuthUserFile /var/www/vhosts/mysite.com/httpdocs/directory/.htpasswd #PLESK style
  10. # AuthUserFile /home/siteaccount/public_html/directory/.htpasswd #CPANEL style
  11. Require valid-user
  12. </Files>
  13.  
  14. # HTPASSWD FILE .htpasswd
  15. username:$apr1$xAwjSNG7$IjfJppVo5zM/8x5SiN6PS1
  16.  
  17. # password generators
  18. # http://www.htaccesstools.com/htpasswd-generator/
  19. # https://www.web2generators.com/apache-tools/htpasswd-generator
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement