How to create a simple .htaccess password protection
This is how you create a simple password protection to your site. Very useful when your are in developing mode and want no one to see even the front page.
First add the following to your .htaccess file. It has to be the full path to the password file.
AuthUserFile /home/myusername/public_html/mydomain.com/.htpasswd
AuthType Basic
AuthName "By Invitation Only"
<files index.php>
Require valid-user
</files>
Then you create a password file named like the file referred to above .htpasswd. If you running WAMP you have to have the password in plain text. On LAMP you have to encrypt the password. Here you can make the encryption of your password.
WAMP
myusername:MySecretPassword
LAMP
myusername:19b9SJ5u29CIw
Save it and now when you visit the site you should get an log in dialogue.
This is another version of htaccess
Order deny,allow
Deny from all
AuthName "Password Required"
AuthUserFile /hotel/www/.htpasswd
AuthType Basic
Require valid-user
Satisfy Any