Friday, May 21, 2010

how to enable mod_rewrite on apache2 server to use .htaccess

First of all check which modules are enabled in apache :
# apache2ctl -M

then if needed enable rewrite :

# a2enmod rewrite


then create the .htpasswd and .htaccess file like following:
#htpasswd -c .htpasswd test

.htpasswd
test:jrCUxJTvKZW12

.htaccess
AuthUserFile /someNotAccessibleDir/.htpasswd
AuthName "private"
AuthType Basic


require valid-user


Then Change AllowOverride None to AllowOverride All
in the /etc/apache2/sites-enabled

restart apache

cheers Alex Barchiesi
http://www.lxphotostudio.info or http://lxphotostudio.mine.nu

No comments:

Post a Comment