[Solved] Lighttpd Drupal 7 ImageCache | Images are broken | error.handler.404

First of all:

Clean URLs need to be enabled, see snippet below.

ImageCache dynamically generates (resizes) images that don't exist. If you upload an image while creating content, e.g:

http://foo.com/files/styles/thumbnail/1337.jpg

The web-server tries to locate the image:

http://foo.com/index.php?q=files/styles/thumbnail/1337.jpg

If it doesn't exist Apache2 (httpd) passes the request to Drupal (index.php) — benefitting from it's 'drupal friendly' rewrite rules — and the image is generated. The standard 'drupal-ish' rewrite rules for lighttpd just return a 404 error page which breaks the ImageCache workflow.

Lighttpd's rewrite rules do support the file exists flag you just need to enable it!

Here's the solution, 'if-not-file' goes before std. rules:

## ImageCache statement goes before standard rules
url.rewrite-if-not-file = (
"^/(.*)$" => "/index.php?q=$1"
)
## Drupal URL-Rewrite rules without LUA
url.rewrite-final = (
"^/system/test/(.*)$" => "/index.php?q=system/test/$1",
"^/search/node/(.*)$" => "/index.php?q=search/node/$1",
"^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
"^/([^.?]*)$" => "/index.php?q=$1"
)

Hope this helps

AttachmentSize
image-cache.txt382 bytes

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.