Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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.

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 – Alaa Alomari Nov 30 '12 at 15:55

You should try this rewrite rule to replace/strip.

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

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

I think it should be

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

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