How to check whether mod_rewrite is enable on server? How to check whether mod_rewrite is enable on server? php php

How to check whether mod_rewrite is enable on server?


from the command line, type

sudo a2enmod rewrite

if the rewrite mode is already enabled, it will tell you so!


  1. To check if mod_rewrite module is enabled, create a new php file in your root folder of your WAMP server. Enter the following

    phpinfo();

  2. Access your created file from your browser.

  3. CtrlF to open a search. Search for 'mod_rewrite'. If it is enabled you see it as 'Loaded Modules'

  4. If not, open httpd.conf (Apache Config file) and look for the following line.

    #LoadModule rewrite_module modules/mod_rewrite.so

  5. Remove the pound ('#') sign at the start and save the this file.

  6. Restart your apache server.

  7. Access the same php file in your browser.

  8. Search for 'mod_rewrite' again. You should be able to find it now.


If you are using a virtual hosts configuration file, make sure the virtual host in question has the directive AllowOverride All somewhere like this:

<VirtualHost *:80>        ...    <Directory "directory/of/your/.htaccess">        AllowOverride All    </Directory></VirtualHost>

Basically, this states to allow processing of all .htaccess directives.