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 192.168.10.160
Satisfy Any

2 comments:

Anonymous said...

great help dude.!

Jasper said...

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