Rewrite to new url issue

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 4
Joined: 30 May 2012, 06:07

Rewrite to new url issue

01 Jun 2012, 12:45

Hi

I am trying to rewrite one url to another as follows: -

RewriteRule ^/subfolder/brandname.asp\?brandname=mybrand$ http://mywebsite.com/folder/newbrand.asp[NC,R=301,L]

When I do this I get redirected to the correct page, but it has the query part appended onto the new url as follows

http://mywebsite.com/folder/newbrand.as ... me=mybrand

But I don want this to happen, so please advise how I stop this?

All I want is http://mywebsite.com/folder/newbrand.asp

User avatar
Posts: 4
Joined: 30 May 2012, 06:07

Re: Rewrite to new url issue

04 Jun 2012, 07:40

Actually I think this is working, but the effect I see is happening in Internet Explorer 8, 9. If I use a different browser then the redirected url is correct. Very strange, any thoughts?

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

Re: Rewrite to new url issue

05 Jun 2012, 05:25

The config for ISAPI_Rewrite 3 should be like this:

RewriteCond %{QUERY_STRING} ^brandname=mybrand$ [NC]
RewriteRule ^/subfolder/brandname\.asp$ http://mywebsite.com/folder/newbrand.asp? [NC,R=301,L]

Notice, the question mark is used at the end of the substitution pattern to prevent initial query string from being appended.

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 7 guests