Replace substring in URL

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 5
Joined: 05 Dec 2012, 01:00

Replace substring in URL

23 Apr 2013, 17:43

Hello. I need to be able to replace a substring in an incoming url. Example: if the url has "northwest-suburbs" anywhere in it, I need that substring to be replaced with "northwest-chicago-suburbs".

Many thanks in advance!

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Replace substring in URL

23 Apr 2013, 23:01

Hello,

Please, try using the following:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} ^/(.*)northwest-suburbs(.*)$ [NC]
RewriteRule .* /%1northwest-chicago-suburbs%2 [NC,R=301,L]


Regards
Andrew

User avatar
Posts: 5
Joined: 05 Dec 2012, 01:00

Re: Replace substring in URL

24 Apr 2013, 02:29

Awesome, thanks!!!

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 16 guests