how to strip string from url using rewrite rule

Posted by Alaa Alomari on Server Fault See other posts from Server Fault or by Alaa Alomari
Published on 2012-11-30T14:31:28Z Indexed on 2012/11/30 17:06 UTC
Read the original article Hit count: 346

Filed under:
|
|

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

© Server Fault or respective owner

Related posts about apache2

Related posts about rewrite