PEHLA KALMA

PEHLA KALMA
Sanaullah Sajid

mod_rewrite is enabled but not working in linux

Trying to get a php routing library set up.They give this example for a .htaccess file save file in your folder.

< ifmodule mod_rewrite.c="" >
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
< /ifModule >

I couldn't get this to work,so tried enabling mod_rewrite,

First of all, set your httpd configuration to this (the path may differ with one another. In my ubuntu it's placed at /etc/apache2/sites-available/default):

DocumentRoot /var/www

< Directory /var/www/ >
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all
< /Directory >


  • sudo a2enmod rewrite


  • restart your apache:



  • sudo service apache2 restart


  • To ensure that, you can check it again from phpinfo in Configuration > apache2handler > Loaded Modules there must be written mod_rewrite and it means mod_rewrite is enabled.