Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I would like htaccess to rewrite into

I'm importing a bunch of pages that have ampersands in the title from MediaWiki. These are encoded as %26. Drupal, for various reasons, has decided double encode the URL to have it become %2526. I simply can't create the alias within Drupal so I have to use htaccess.

This is what I have as my rule so far as RewriteRule ^w/([^%26]+)\%26(.*)$ w/$1\%2526$2 [R=301]

I asked this question three months ago on stackexchange and was not able to get it working. I tried hiring a contractor for this but was unable to find one. So this my last ditch effort before I completely give up. I really appreciate the help.

All the best, Patrick

share|improve this question

migrated from Mar 27 '11 at 8:00

This question came from our site for system and network administrators.

In all honesty, wouldn't it be better for everyone involved to run an UPDATE query against drupal's database to convert all the %26's back to ampersands, so that Drupal stops double-encoding them? – DerfK Jan 3 '11 at 16:49
@DerfK That would break links from other sites. Since there's about a 1000 pages with this problem, I would like to avoid this but if I don't find a solution, then that I just have to do it. Thanks – Patrick Jan 3 '11 at 17:02

1 Answer 1

'noescape|NE' (no URI escaping of output)

This flag prevents mod_rewrite from applying the usual URI escaping rules to the result of a rewrite. Ordinarily, special characters (such as '%', '$', ';', and so on) will be escaped into their hexcode equivalents ('%25', '%24', and '%3B', respectively); this flag prevents this from happening. This allows percent symbols to appear in the output

mod_rewrite Documentation at

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.