Re direct dynamic urls to one static url

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 5
Joined: 10 Feb 2013, 17:39

Re direct dynamic urls to one static url

10 Feb 2013, 17:48

Hi, I have many query string urls like this which no longer exists and I need to do a 301 redirect on all the queries to that page, to one static page (my homepage).

Code: Select all
http://www.mysite.com/tips.asp?tip=search-for-freedom

The methods I have tried when redirected have left me with the homepage url like this
Code: Select all
http://www.mysite.com?tip=search-for-freedom


Is there a way to redirect all the queries to just
http://www.mysite.com

Thanks in advance
All the best
Richard

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

Re: Re direct dynamic urls to one static url

11 Feb 2013, 01:23

Hello,

Sure, the rule you have is excellent, because it worked. All you need to do is to tweak it a little.
Lets say you have a rule:

Code: Select all
RewriteCond %{QUERY_STRING} ^tip=([^&]+)$
RewriteRule ^typs\.asp$ / [NC,R=301,L]


All you need is to add '?' at the end of the destination URL:

Code: Select all
RewriteCond %{QUERY_STRING} ^tip=([^&]+)$
RewriteRule ^typs\.asp$ /? [NC,R=301,L]


Regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 0 guests