Can't enable use of .htaccess in apache2 Can't enable use of .htaccess in apache2 apache apache

Can't enable use of .htaccess in apache2


I had the same problem and this wasted my 5 hours to fix. Here is the solution:

So In order to use mod_rewrite you can type the following command in the terminal:

a2enmod rewrite

Then restart your Apache.

service apache2 restart

Now your htaccess file work fine


editing /etc/apache2/sites-available/my-virtual-host-path and changing the Directory block to target /var/www/my-virtual-host-path and setting AllowOverride All in that file now allows the .htaccess file to be run.

I suppose that the /etc/apache2/sites-available/default file is only used when you aren't using a virtual host.


If you are stand on Root folder

your .htaccess should like

<IfModule mod_rewrite.c>     RewriteEngine on     RewriteRule  ^$ app/webroot/  [L]     RewriteRule  (.*) app/webroot/$1 [L]   </IfModule>

f you are stand in to app folder

your .htaccess should like

 <IfModule mod_rewrite.c>      RewriteEngine on      RewriteRule  ^$  webroot/  [L]      RewriteRule  (.*) webroot/$1  [L]   </IfModule> 

Use this URL as well http://technologiessolution.blogspot.in/search?q=.htaccess