views:

59

answers:

1

We were forced to upgrade to Apache 2 today and as soon as we did our rule set that was working for months stopped working.

The behavior it shows is completely ignoring the .htacess, even after we delete it (.htacess) the server seems to use a "phantom" rule.

IE: site/stuff/ without .htacess should show a 404... but instead it goes to site/stuff.php (no .htacess at all!)

With .htacess enabled site/stuff/1/ should go to site/stuff.php?var=1 instead it goes to site/stuff.php

Any help appreciated, it's driving us crazy.

+4  A: 

I'm going to guess it's an Apache configuration problem.

Your main httpd.conf has likely set a default for the AllowOverride directive, to None. This is a restrictive set of permissions that improves performance and security, but it means that Apache completely ignores any .htaccess files.

You need to enable AllowOverride for your serving directory, either in the main Apache config file or inside the VirtualHost directive. You can do this by specifying

AllowOverride All

inside your <VirtualHost> or <Directory> block.

EDIT (in response to comments)

Without more information, it will be pretty difficult to diagnose. If you can provide some more details, it would probably help. It does seem that your URLs are being rewritten, so you can try enabling mod_rewrite debugging to see how the rules are getting applied:

<IfModule mod_rewrite.c>
    RewriteLog "/path/to/rewrite.log"
    RewriteLogLevel 3
</IfModule>

2nd Edit - MultiViews

After re-reading the description of your problem, I think you might have an issue with MultiViews. It sounds very similar to this thread I found. Try disabling MultiViews under your <VirtualHost> or <Directory>, they're probably mucking with your rewrite rules.

zombat
We checked that as a first suspect repeatedly and set that to All and the behaviour was still happening.We resorted to rolling back to the old Apache as this is really weird. If anyone else has any other suggestions that would be great as we do need some of the new features in Apache 2
I added a bit about mod_rewrite debugging... perhaps that will be of some use?
zombat
With some more digging, I'm suspecting MultiViews now. See edit above.
zombat