Replace / substitute %2F with /

ISAPI_Rewrite is a powerful URL manipulation engine based on regular expressions
User avatar
Posts: 18
Joined: 06 Apr 2012, 23:12

Replace / substitute %2F with /

08 Jan 2015, 21:21

Hello,

Can you tell me how I substitute/replace encoded characters in a url that is not working on our site.

For example how would I replace the %2F with a / in the following url:

http://www.mydomain.com/sporting-fitnes ... workout%2F

to

http://www.mydomain.com/sporting-fitnes ... c-workout/

We have several urls with this issue and some have a different amount of directories so we need it to dynamically replace however many %2F's there are with /

Thank you,
Shawn

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

Re: Replace / substitute %2F with /

09 Jan 2015, 06:21

Hello, Shawn

What you want is only possible in ISAPI_Rewrite 3 as v2 does not have a loop function.
The rule for v3 will look as follows:

RewriteBase /
RewriteRule ^(.*)\%2F(.*)$ $1/$2 [NC,LP,L]

User avatar
Posts: 18
Joined: 06 Apr 2012, 23:12

Re: Replace / substitute %2F with /

09 Jan 2015, 20:23

Thank you. How do I tell what version we have?

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

Re: Replace / substitute %2F with /

12 Jan 2015, 06:25

Hello, Shawn

Well, the easiest way is to check the name of your config files:
if they are httpd.ini, then it's v2
if they are httpd.conf and .htaccess, then it's v3

User avatar
Posts: 5
Joined: 10 Apr 2015, 08:14

Re: Replace / substitute %2F with /

10 Apr 2015, 09:57


User avatar
Posts: 5
Joined: 10 Apr 2015, 08:14

Re: Replace / substitute %2F with /

10 Apr 2015, 09:57


User avatar
Posts: 5
Joined: 10 Apr 2015, 08:14

Re: Replace / substitute %2F with /

10 Apr 2015, 09:57


Return to ISAPI_Rewrite 2.x

Who is online

Users browsing this forum: No registered users and 1 guest