Apache2: 400 Bad Reqeust with Rewrite Rules, nothing in error log?
- by neezer
This is driving me nuts.
Background: I'm using the built-in Apache2 & PHP that comes with Mac OS X 10.6
I have a vhost setup as follows:
NameVirtualHost *:81
<Directory "/Users/neezer/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:81>
ServerName lobster.dev
ServerAlias *.lobster.dev
DocumentRoot /Users/neezer/Sites/lobster/www
RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
LogLevel debug
ErrorLog /private/var/log/apache2/lobster_error
</VirtualHost>
This is in /private/etc/apache2/users/neezer.conf.
My code in the lobster project is PHP with the CodeIgniter framework. Trying to load http://lobster.dev:81/ gives me:
400 Bad Request
Normally, I'd go check my logs to see what caused it, yet my logs are empty! I looked in both /private/var/log/apache2/error_log and /private/var/log/apache2/lobster_error, and neither records ANY message relating to the 400. I have LogLevel set to debug in /private/etc/apache2/http.conf.
Removing the rewrite rules gets rid of the error, but these same rules work on my MAMP host. I've double-checked and rewrite_module is loaded in my default Apache installation. My http.conf can be found here: https://gist.github.com/1057091
What gives? Let me know if you need any additional info.
NOTE: I do NOT want to add the rewrite rules to .htaccess in the project directory (it's checked into a git repo and I don't want to touch it).