Sunday, January 16, 2011

Apache2 not reading mod_rewrite rules

I have my apache server set up to read from settings. Everything works except mod_rewrite

eg.

<VirtualHost *>
        ServerAdmin 
        ServerName 
        ServerAlias www.
        DocumentRoot /home/sitehome

        <Directory />
        ServerSignature Off
        Options -Indexes
        DirectoryIndex index.php

        RewriteEngine On
        RewriteBase /
        RewriteRule ^index\.html$ index.php [NC,L]
        </Directory>

</VirtualHost>

Apache won't follow the rewrite rules, and say that "index.html" doesn't exist, but if I put a .htaccess file in the sitehome directory, it'll read that and apply the rewrite rules correctly.

Why would this happen?

System: Ubuntu 7.10 Gutsy with Apache2

  • Shouldn't your Directory directive look more like this:

    <Directory /srv/www/htdocs/>
    
    Richard : Wow, that worked. Thanks a bunch!
    From Josh Budde

0 comments:

Post a Comment