Changes from Version 1 of Installation/SettingUpModRewrite

Show
Ignore:
Author:
demian (IP: 81.1.81.57)
Timestamp:
01/02/07 14:38:54 (7 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Installation/SettingUpModRewrite

    v0 v1  
     1= Setting up mod_rewrite = 
     2[[TOC]] 
     3Although many servers are setup with this module enabled by default, there are always exceptions. 
     4 
     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 
     7 
     8 
     9{{{ 
     10httpd -l 
     11}}} 
     12 
     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  
     14 
     15 
     16{{{ 
     17<?php phpinfo(); ?> 
     18}}} 
     19 
     20If you're compiling Apache yourself, you simply need to add the following to your configure line 
     21 
     22 
     23{{{ 
     24./configure --enable-module=rewrite 
     25}}} 
     26 
     27If you're using a distribution's packaged version of Apache, eg, Fedora Core, you have to install the related devel tools 
     28 
     29 
     30{{{ 
     31yum install apache2-devel 
     32}}} 
     33 
     34These effectively make the mod_rewrite module available. 
     35 
     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  
     38 
     39 
     40{{{ 
     41AllowOverride None 
     42}}} 
     43 
     44 
     45to 
     46 
     47 
     48{{{ 
     49AllowOverride All 
     50}}} 
     51 
     52 
     53To get around this you need to edit your httpd.conf file, and search for '''!AllowOverride'''. 
     54 
     55The first instance you will find applies to the root directory, it's '''not''' the one you want: 
     56 
     57 
     58{{{ 
     59<Directory /> 
     60}}} 
     61 
     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,  
     63 
     64{{{ 
     65 
     66<Directory /path/to/your/site> 
     67    Options FollowSymLinks 
     68    AllowOverride All 
     69</Directory> 
     70}}} 
     71 
     72Once you've saved your changes, restart Apache for them to take effect.