Apache 2 Upgrade Killed Our .htaccess, Can't fix, please help!
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开发者_如何学JAVA 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.
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.
精彩评论