RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php

    RewriteRule ^site-css/([0-9]+)/(.*)$     ../application/site/$1/design/css/$2 [L]

Which returns a 400 bad request, or at an apache level:

[Thu Jul 22 14:48:32 2010] [error] [client] Invalid URI in request GET /site-css/1/layout.css? HTTP/1.1

If I change the rule even slightly, it changes to a 404 error.

Is there any further way to debug this issue?


Is there any further way to debug this issue?

Yes, enable mod_rewrite's extensive logging facilities: see the RewriteLog and RewriteLogLevel directives.

That said, on first glance, the ../ looks fishy. I would first try reworking the substitution target to an absolute path/URL, or alternatively, use a RewriteBase.

  • Ive put it in my apache httpdocs and now theres no error, but its not logged. That command doesn't work in terminal for me, I'm using the Macs built in webserver. – azz0r Jul 22 '10 at 14:17
  • You'd use apachectl configtest on OS X; but if the error's gone now, it was most likely due to a non-existing directory. – earl Jul 22 '10 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.