Wednesday, July 21, 2010

How to password protect PHP/Wordpress with htpasswd.

First Create .htpasswd file.

htpasswd -c  /opt/app/.htpasswd admin
New password:
Re-type new password:

After that you can add .htaccess in  your application.

vi /opt/app/.htaccess

AuthUserFile /opt/app/.htpasswd
AuthGroupFile /dev/null
AuthName admin
AuthType Basic
require valid-user

# Enable only if you want authentication less access for some specific host.
Allow from
Satisfy Any


Anonymous said...

great help dude.!

Jasper said...

Seems like the media uploader is getting http errors using this type of http authentication.

Renu said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in electronic city