Apache2: 400 Bad Reqeust with Rewrite Rules, nothing in error log?
Posted
by
neezer
on Server Fault
See other posts from Server Fault
or by neezer
Published on 2011-06-30T21:54:43Z
Indexed on
2011/07/01
0:23 UTC
Read the original article
Hit count: 379
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).
© Server Fault or respective owner