views:

100

answers:

2

Using a .htaccess rewrite rule, I need to add "?q=" before the path on any URL's containing the word "imagecache"

Therefore, if the URL is:

http://mysite.com/sites/default/files/imagecache/myimage.jpg

...then it will really try:

http://mysite.com/?q=sites/default/files/imagecache/myimage.jpg

But that will ONLY happen if the URL contains "imagecache." Otherwise, it does no rewriting.

Also, this will only happen if /sites/default/files/imagecache/myimage.jpg isn't already an existing image file. I believe I can do that using:

RewriteCond %{REQUEST_FILENAME} !-f

...right? It's just the first part that I can't figure out.

A: 
RewriteRule ^mysite.com/(.*)/imagecache/(.*)$ mysite.com/?q=$1/imagecache/$2
Zurahn
+1  A: 

Something like this?:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*imagecache.*)$ /?q=$1 [L,QSA]
Chris Smith