Connecting Tech Pros Worldwide Help | Site Map

301 redirect with select

Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#1: Sep 17 '08
Hi, anyone know how to write a select or if 301 redirect

Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <%
  3. ' Permanent redirection
  4. Response.Status = "301 Moved Permanently"
  5. Response.AddHeader "Location", "./"
  6. Response.End
  7. %>
basicall I need if
http://www.mysite/direct?cat=2
is requested redirect to new page
if
http://www.mysite/direct?cat=5
is requested redirect to its new page
and so on


Thanks if anyone knows
Richard
codegecko's Avatar
Moderator
 
Join Date: May 2007
Location: United Kingdom
Posts: 395
#2: Sep 19 '08

re: 301 redirect with select


Hi Richard,

You want something like this:

Expand|Select|Wrap|Line Numbers
  1. 'This checks to see if the "cat=5" bit in http://mysite.com/direct?cat=5 actually
  2. ' exists, then we can do something with it
  3. If Len(Request.QueryString("cat")) > 0 Then
  4. 'Let's redirect
  5. Response.AddHeader("Status", "301 Moved Permanently")
  6. Response.AddHeader("Location", "Your_new_url.asp")
  7. End If
  8. Response.End
  9.  
Hope this helps.

medicineworker
Familiar Sight
 
Join Date: Jul 2006
Posts: 181
#3: Sep 22 '08

re: 301 redirect with select


Dear medicineworker, Thanks just what I needed.
Great
Richard
Reply


Similar ASP / Active Server Pages bytes