I have an issue with Lighttpd Rewrite and static files.

Here is my rewrite syntax:

url.rewrite = (
    "^/(.*)\.(php|css|js|jpg|png)$" => "$0",
    "^/(.+)$" => "/router.php?url=$1"

All .css and .js files load up just fine but no images load up. I have attempted check if the file is being served from /images but that does not fix the issue. I checked the access logs and all css and js files have a 200 status but all image files have a 404. The paths are correct.

Does anyone have an idea why the .css and .js files would load properly but images do not.

  • Instead of url.rewrite, try url.rewrite_once; and also check the extensions of your images – Ahmed Nuaman Feb 24 '11 at 16:10

If you change url.rewrite = to url.rewrite-if-not-file = this may fix the issues you are having.

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.