Hi, I'm using Virtualsite_manager, which works pretty well. For files attachments as well.

But I still can't get ImageCache 2.1 to called, Drupal always sends me a 404 not found from menu_execute_active_handler() on this test:

 if ($path === '' || !isset($menu['callbacks'][$path])) {
   return MENU_NOT_FOUND;
 }

I'm using the .htaccess following rules :

RewriteEngine on 

#file access
RewriteRule ^\w+/(modules|misc|files|themes|sites)(.*)$ ./$1$2 [L]
RewriteRule ^/(modules|misc|files|themes|sites)(.*)$ ./$1$2 [L]

#special php scripts
RewriteRule ^\w+/(update.php|install.php|index.php|cron.php)(.*)$ ./$1$2 [L,QSA]

#site sub-section
RewriteCond %{REQUEST_FILENAME} ^/Applications/MAMP/htdocs/dotc/site/.*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^\w+(/)?(.*)$ index.php?q=$2 [L,QSA]

I gave a try by deleting 'files' from RewriteRule like this:

RewriteRule ^\w+/(modules|misc|themes|sites)(.*)$ ./$1$2 [L]
RewriteRule ^/(modules|misc|themes|sites)(.*)$ ./$1$2 [L]

This leads ImageCache to work properly, but attachements don't work anymore.

I'm not a Apache rewriting rules expert at all, but I guess I can fix the issue with a rule excluding only 'files//imagecache', but I don't know how to achieve this.

Help would be much appreciated!

Thank you all,
Jérémy

Comments

jchatard’s picture

Just correcting a typo in my previous comment:

I'm not a Apache rewriting rules expert at all, but I guess I can fix the issue with a rule excluding only 'files/site_shortname/imagecache', but I don't know how to achieve this.

jchatard’s picture

Just a quick note, when disabling URL aliases, all works fine!

Jérémy

schuyler1d’s picture

I'm not a Apache rewriting rules expert at all
get ready, my guess is by the end of this, you will be :-/

Just a quick note, when disabling URL aliases, all works fine!
in drupal? you mean clean urls or something else?

I don't have time atm to do testing on my side, but a shot in the dark would be something like this:

RewriteEngine on

#file access
RewriteRule ^\w+/(modules|misc|themes|sites)(.*)$ ./$1$2 [L]
RewriteRule ^/(modules|misc|themes|sites)(.*)$ ./$1$2 [L]

#NEW STUFF
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/(files)(.*)$ ./$1$2 [L]

RewriteCond %{REQUEST_URI} ^\w+/(files.*)$
RewriteCond %1 -f
RewriteRule ^\w+/(files)(.*)$ ./$1$2 [L]

#special php scripts
RewriteRule ^\w+/(update.php|install.php|index.php|cron.php)(.*)$ ./$1$2 [L,QSA]

#site sub-section
RewriteCond %{REQUEST_FILENAME} ^/Applications/MAMP/htdocs/dotc/site/.*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^\w+(/)?(.*)$ index.php?q=$2 [L,QSA]

The trickiest part is that imagecache is specifically relying on the request being passed to drupal if and only if a file does not exist.

If you figure this out (or if the above magically worked), please post what you did here, so I can commit it back into the project! Otherwise I might have some time later this week or next.

jchatard’s picture

Wouah thanks a lot, I'll give it a try tomorrow morning (midnight in France), and I'll let you know if it works!

In the mean time thank you!

Jérémy

jchatard’s picture

Ok so it works great, appart for one thing. Now images are well generated, thank you!

But when I edit a node, the imagefield preview, which points to the original image, doesn't show and leads to a 404 not found page.

I guess a simple rule could let access files directly?
Jérémy

schuyler1d’s picture

what's the url of the imagefield preview image, and can you see these images from the view mode of the same node? It's possible this part is a bug in imagefield/imagecache instead.

jchatard’s picture

Well I don't think this is a bug due to Imgafield nor ImageCache, cause Drupal also generate a 404 for attached files as well! I'm using public method.

Seems like rewrite rules prevent from accessing files under "files/" directory.

jchatard’s picture

Status: Active » Closed (fixed)

You where right, this an issue due to imagefield. Many people seem to have the same. So I'll work on that.
Thanks

schuyler1d’s picture

Status: Closed (fixed) » Needs review

keeping this open for the patch to the rewrite rules. thanks for reporting