Ubuntu – .htaccess file not running and internal server error

.htaccess14.04Apache2mod-rewrite

I am using ubuntu 14.04 and have LAMP environment. I have one of the project in dir /var/www/html/project1 . It can't access the .htaccess file for rewriting url rules.

For that i have to change in /etc/apache2/apache2.conf file

   <Directory /var/www/>
          Options Indexes FollowSymLinks
          AllowOverride All       # change None to All
          Order allow,deny
          allow from all
          Require all granted
   </Directory>

But after this change my Apache server gives an error "Internal Server error"

And If I'll change 'AllowOverride None' then site is running correctly But .htaccess file doen't work.

Best Answer

I had the same issue. After searching a lot I have found that @Doug Smythies's way perfectly work for me. Up vote.

So I go to the terminal and run the following code:

sudo a2enmod rewrite
sudo service apache2 restart

And that's it. Hope this will help others.

Related Question