Encrypting your page using htaccess password (htpasswd) – with CLI as well ;)


Share the open word!

The website that are on development phase, mockup sites and other public pages hosted in apache with data needs to be protected from public access . The protection will help to:
-prevent from being indexed
-prevent from unauthorized users
-prevent the mockup sites from spammers

First of all we need a password file (.passwd) which has the username and the password in encrypted form e.g.:

admin:KqwNIkWABCiEE

This can be created using many online tools like this one .

Or, we can always turn to our command line for this 🙂

#htpasswd -c /path/to/.htpaswd admin

New password:
Re-type new password:
Adding password for user admin

If you already have the .htpasswd file and would like to append a new user, repeat the command with the “-c”

#htpasswd c /path/to/.htpaswd admin2

After we are done with the .htpasswd,  we can create .htaccess file with following content in the document root of the…

View original post 42 more words

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s