If you would like to enable mod_rewrite in your apache, for friendly URLs or other redirect requirements, please follow these instructions

install apache - 'su' to root or 'sudo' and install apache

  • apt-get install apache2 

Enable mod_rewrite

  • a2enmod rewrite

Verify the module is now installed

  • updatedb
  • locate mod_rewrite.so
  • it will found in /usr/lib/apache2/modules

Load the module in the configuration

  • OLD STYLE :
    cd /etc/apache2/mods-enabled
    touch rewrite.load
    gedit rewrite.load 
    LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
    OR

  • Enable override

Enable override so that mod_apache can handle requests in the specific directory

  • in /etc/apache2/sites-available/000-default edit
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None (from None to all)
    Order allow,deny
    allow from all

Restart apache

  • /etc/init.d/apache2 restart
    or
    service apache2 restart

If you have any comments please contact me.

Popular Links