Tuesday 1 June 2010

Apache htaccess simple config

AllowOverride AuthConfig - Provide login screen before view the web site
Sample config:
httpd.conf
====================================
Options FollowSymLinks
AllowOverride AuthConfig
Order allow,deny
Allow from all

AccessFileName .htaccess
====================================

/var/www/html/.htaccess
====================================
AuthName "htaccess protect"
Authtype Basic
AuthUserFile /var/www/.htpasswd <---the .htpasswd file will be created later
require valid-user
(or you can change to specify user "require user tom")
====================================

Create .htpasswd file:
htpasswd -c /var/www/.htpasswd owner

Add another account:htpasswd /var/www/.htpasswd tom

No comments:

Post a Comment