0

Possible Duplicate:
Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask?

sometimes my drupal site add extra string to image url which causes the image to be broken. the url is

http://mysite.com/sites/default/files/imagecache/list_image_page/%252Fsites/default/files/img.jpg

what is the needed rewrite rule to strip the bolded (%252F) part in the above link
ie. to be:

http://mysite.com/sites/default/files/imagecache/list_image_page/sites/default/files/img.jpg

I have tried this, but didn't work

RewriteCond %{QUERY_STRING} ^(.*)\%252Fsites(.*)$
RewriteRule %{REQUEST_URI}  %1sites%2
Alaa Alomari
  • 638
  • 5
  • 18
  • 37

3 Answers3

2

You should try this rewrite rule to replace/strip.

RewriteRule ^(.*)[%252F](.*)$ $1$2 [N]
Ram G
  • 231
  • 1
  • 2
0

Are you sure it's a bug in Drupal? The last comment of the bug report you linked to says this:

If you are using custom code, please remove the leading / in your image path.

longneck
  • 22,793
  • 4
  • 50
  • 84
0

I think it should be

RewriteRule ^(.*)%2Fsites(.*)$ $1sites$2 [L,R=301,NC]
Alaa Alomari
  • 638
  • 5
  • 18
  • 37