Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question

marked as duplicate by voretaq7 Dec 1 '12 at 14:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
You should fix the broken Drupal code. –  Michael Hampton Nov 30 '12 at 15:31
    
i wish that!!! i have tried it for 2 days!! but this is a bug in image cache module as appears in drupal.org/node/1212418 –  Alaa Alomari Nov 30 '12 at 15:55
add comment

3 Answers 3

You should try this rewrite rule to replace/strip.

RewriteRule ^(.*)[%252F](.*)$ $1$2 [N]
share|improve this answer
1  
it didn't work :( –  Alaa Alomari Nov 30 '12 at 15:37
add comment

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.

share|improve this answer
    
this is if you are using custom code... but in my case i am using VIEWS module which is for drupal itself –  Alaa Alomari Nov 30 '12 at 16:12
add comment

I think it should be

RewriteRule ^(.*)%2Fsites(.*)$ $1sites$2 [L,R=301,NC]
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.