ModRewrite + Imagecache

johsw - May 10, 2007 - 08:39
Project:ImageCache
Version:5.x-1.2
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi All!

I have some problems with my ModRewrite setup for clean url's and imagecache.

My problem is that every time I load a imagecachepicture, a new picture is genererated.

As I've understood the imagecache it creates a new file, if one is not already present. Looking through the code it seems that it gets run every time. This means, that it must be ModRewrite rules, that check if a file is already there. As I understand ModRewrite this is done by the line   RewriteCond %{REQUEST_FILENAME} !-f . This line is in my vHost configuration.

Have you got any idea of what idea to do?

The central part of my vhost setup is here

# Protect files and directories from prying eyes.
<Files ~ "(\.(inc|module|pl|sh|sql|theme|engine|xtmpl)|Entries|Repositories|Root|scripts|updates)$">
  Order deny,allow
  Deny from all
</Files>

# Set some options.
Options -Indexes
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings in Apache 2 (Apache 1.3 code removed as it is irrelevant here).
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# Reduce the time dynamically generated pages are cache-able.
<IfModule mod_expires.c>
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules (old-style Cond/Rules removed as they are unnecessary in my setup)
<IfModule mod_rewrite.c>
  RewriteEngine on
  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !^/misc
  RewriteCond %{REQUEST_FILENAME} !^/sites
  RewriteCond %{REQUEST_FILENAME} !^/themes
  RewriteCond %{REQUEST_FILENAME} !^/modules 
  #RewriteCond %{REQUEST_FILENAME} !^/files/avisbilleder/alternative
  #RewriteCond %{REQUEST_FILENAME} !^/files/skribentbilleder
  RewriteCond %{REQUEST_FILENAME} !^/files/forsidebilleder
  RewriteCond %{REQUEST_FILENAME} !^/files/annoncer
  #RewriteCond %{REQUEST_FILENAME} !^/files/imagecache
  RewriteCond %{REQUEST_FILENAME} !^/cron.php
  RewriteCond %{REQUEST_FILENAME} !\.(php|ico|css|js|html?)(\W.*)?
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^/(.*)$ /index.php?q=$1 [L,QSA]
  #RewriteLogLevel 3
  #RewriteLog "/Library/Tenon/WebServer/WebSites/rewrite.log"

</IfModule>

Best,
/Johs.

#1

dopry - December 6, 2007 - 18:48
Status:active» closed

no the !-f is there in the rewrite rules it shoudl be working, unless a .htaccess file is in the wya.

 
 

Drupal is a registered trademark of Dries Buytaert.