Monday, October 18, 2010

Apache - Add authentication on site

To enable login on your site, you need two files:

1. .htpasswd - can be saved anywhere as long as it's secure
2. .htaccess - must be on the root directory of the site

On your .htpasswd, define the username and password on this format:

username:password

On your .htaccess, have these lines:

AuthUserFile "C:/wamp/pwds/.htpasswd"
AuthName "Valid Users"
AuthType Basic
require valid-user

No comments:

Post a Comment