.htaccess password protect
A 30 second recap on how to protect your site with a username and password using .htaccess
- Find and run 'htpasswd -c /var/www/html/sec/pass.htpasswd ryan'
- Create a .htaccess in the directory you want to protect and add the following lines:
- Ensure that 'AllowOveride All' is set for the directory in which .htaccess lives, otherwise the config file wont be processed.
-c is to create a new file, ryan is the username. You'll be prompted for a password
AuthName "Secure Login"
AuthType Basic
AuthUserFile "/var/www/html/sec/pass.htpasswd"
require valid-user
Here we're saying the user just needs to exist in the file we created earlier, for more detailed setups, use google.
Cheers
Ryan Partington


