replace %26 with &

ISAPI_Rewrite is a powerful URL manipulation engine based on regular expressions
User avatar
Posts: 2
Joined: 18 Jul 2013, 11:27

replace %26 with &

18 Jul 2013, 11:34

There are some other sites that link to mine and use %26 in the link instead of &. I need a URL rewrite to convert any %26 in the URL to a &.

an example is mysite.com/vacation.asp?AmentID=85%26State=Hawaii

I want it to become
mysite.com/vacation.asp?AmentID=85&State=Hawaii

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: replace %26 with &

22 Jul 2013, 07:06

Please try to use the following config:

RewriteCond %{QUERY_STRING} ^(.+?)\%26(.*)$ [NC]
RewriteRule .? %{REQUEST_URI}\?%1&%2 [LP,L]

User avatar
Posts: 2
Joined: 18 Jul 2013, 11:27

Re: replace %26 with &

22 Jul 2013, 15:00

thank you for the response, but I go to
mysite.com/vacation.asp?AmentID=85%26State=Hawaii
and nothing happens. It just stays as /vacation.asp?AmentID=85%26State=Hawaii

my httd.ini file is quite large and I've used it for a very long time as is until this latest change.

here is the first part and where I put the new code:
[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32




# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]
# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]

# fix URLs that have %26 instead of &
RewriteCond %{QUERY_STRING} ^(.+?)\%26(.*)$ [NC]
RewriteRule .? %{REQUEST_URI}\?%1&%2 [LP,L]


# minivacs
RewriteRule /vacation-packages/([^/]+)/([^/]+) /vacation-packages/minivacs.asp\?state=$1&city=$2 [I,L]
RewriteRule /vacation-packages/([^/]+)/([^/]+)/ /vacation-packages/minivacs.asp\?state=$1&city=$2 [I,L]

etc. much more after this.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: replace %26 with &

23 Jul 2013, 09:55

I'm sorry, I've confused v2 and v3 syntax... Here's the rule for v2:

RewriteRule (.*?)\?(.+?)\%26(.*) $1\?$2&$3 [NS,L]

Return to ISAPI_Rewrite 2.x

Who is online

Users browsing this forum: No registered users and 3 guests