How To Set Up Apache Mod_Rewrite Module in CentOS

About Mod_Rewrite

Mod_Rewrite is an Apache module used to manipulate URL’s and is compiled into the base Apache HTTP Server in CentOS.  See the mod_rewrite documentation for more information.

How to configure the Apache mod_rewrite module

  1. Open the Apache configuration file located at /etc/httpd/conf/httpd.conf
    sudo vi /etc/httpd/conf/httpd.conf
  2. Change AllowOverride None to AllowOverride All inside the DocumentRoot Directory Directive, normally <Directory “/var/www/html”>
    AllowOverride None
    to
    AllowOverride All
  3. If the root directory is different, change AllowOverride None to AllowOverride All inside the Directory Directive, normally <Directory />
    e.g
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>

    to
    <Directory />
    Options FollowSymLinks
    AllowOverride All
    </Directory>
  4. After you save and exit that file, restart apache.
    sudo service httpd restart

Have something to Add?

Loading Facebook Comments ...
Loading Disqus Comments ...