Changes from Version 1 of Installation/SettingUpModRewrite

demian (IP:
01/02/07 14:38:54 (7 years ago)



  • Installation/SettingUpModRewrite

    v0 v1  
     1= Setting up mod_rewrite = 
     3Although many servers are setup with this module enabled by default, there are always exceptions. 
     5== Is the module loaded? == 
     6In some cases, the module will be compiled into the the httpd binary, if so you can check for mod_rewrite's presence with 
     10httpd -l 
     13If it doesn't show up in the list, it may be loaded as a Dynamic Shared Object, in this case you should be able to find it in the output of  
     17<?php phpinfo(); ?> 
     20If you're compiling Apache yourself, you simply need to add the following to your configure line 
     24./configure --enable-module=rewrite 
     27If you're using a distribution's packaged version of Apache, eg, Fedora Core, you have to install the related devel tools 
     31yum install apache2-devel 
     34These effectively make the mod_rewrite module available. 
     36== Now mod_rewrite is loaded, but still it doesn't work == 
     37This is very typical, it just means your Apache configuration by default doesn't allow the use of custom .htaccess files.  You will need to change  
     41AllowOverride None 
     49AllowOverride All 
     53To get around this you need to edit your httpd.conf file, and search for '''!AllowOverride'''. 
     55The first instance you will find applies to the root directory, it's '''not''' the one you want: 
     59<Directory /> 
     62The second one applies to the webroot, you can modify this but you may not want to allow mod_rewrite on all your sites.  Ideally you need to create a directory stanza just for your particular site,  
     66<Directory /path/to/your/site> 
     67    Options FollowSymLinks 
     68    AllowOverride All 
     72Once you've saved your changes, restart Apache for them to take effect.