.htaccess file not working on Ubuntu 14.04 with apache2 .htaccess file not working on Ubuntu 14.04 with apache2 apache apache

.htaccess file not working on Ubuntu 14.04 with apache2


From your information I can only guess ("doesn't work" isn't very specific).
Most probably you did not enable mod_rewrite. Type in:

a2enmod rewrite

and restart Apache after:

service apache2 restart


First StepOpen file as

sudo vim /etc/apache2/apache2.conf

Second Stepremove comment sign (#) if you find it before this line ( line number 187 approx.)AccessFileName .htaccess

Third StepThen find the line where there is Options Indexes FollowSymLinks AllowOverride None Require all granted

replace "None" with "All"

AllowOverride All

.htaccess it's works!!


If its Ubuntu LAMP fresh installation, you can followup with these steps. It just the sum-up from the above points:

Step 1:

If you have sudo access for your Ubuntu server open the apache2.conf file

root@etc/apache2$ vi apache2.conf

Step 2:

Change Directory /var/www/ from AllowOverride None to AllowOverride Allshare the file permission level for .htaccess from denied to granted

Step 3:

Change the same settings in root@etc/apache2/sites-enabled/$ vi 000-default.conf file

Step 4:

Run a2enmod rewrite

This step is really important. It prompts you to restart the server.

Step 5:Restart the server

service apache2 restart  

if the above step fails run

 sudo /etc/init.d/apache2 restart