17 July, 2009

.htaccess on ubuntu with apache install not working

How to get .htaccess file to work in Ubuntu and Apache2.
In example I use Apache v2.2, and Ubuntu 9.04
after install apache v2.2 on my ubuntu, i make a .htaccess file with .htpasswd, everything according standard set up, was fine, but i could not make my .htaccess file to work, i tried almost everything , i could not get a answer on the net, then i find a little detail on apache.org. here is explanation..
u open yours preferred terminal, I use nano.
Log in at “root” and type:
# nano /etc/apache2/sites-enabled/000-default

there you will find VirtualHost set up:


ServerAdmin webmaster@localhost

DocumentRoot /var/www

Options FollowSymLinks
AllowOverride All


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

….


and change “AllOverride None” to “AllOverride All”
and you .htaccess file will work


The use of .htaccess files can be disabled completely by setting the AllowOverride directive to "None" or if you wanna enable you need to set directive to “All
AllowOverride None

!remember to make a .htpasswd file to, put dem (.htaccess, .htpasswd) in the same directory.

/var/www

Ubuntu , Apache2 , .htaccess easy set up..
her is example for .htaccess file

AuthName "Password Protected Area"
AuthType Basic
AuthUserFile /var/www/.htpasswd
DirectoryIndex index.html
require valid-user


and here example for .htpasswd file

someuser:mo3wsdmzk3yX6

on the net you can find any .htaccess generator
and easy to use...

I hope I give your some idea

No comments: