301 redirect with select

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fran7
    New Member
    • Jul 2006
    • 229

    301 redirect with select

    Hi, anyone know how to write a select or if 301 redirect

    Code:
    <%@ Language=VBScript %>
    <%
    ' Permanent redirection
    Response.Status = "301 Moved Permanently"
    Response.AddHeader "Location", "./"
    Response.End
    %>
    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
  • JamieHowarth0
    Recognized Expert Contributor
    • May 2007
    • 537

    #2
    Hi Richard,

    You want something like this:

    Code:
    'This checks to see if the "cat=5" bit in http://mysite.com/direct?cat=5 actually
    ' exists, then we can do something with it
    If Len(Request.QueryString("cat")) > 0 Then
    'Let's redirect
    Response.AddHeader("Status", "301 Moved Permanently")
    Response.AddHeader("Location", "Your_new_url.asp")
    End If
    Response.End
    Hope this helps.

    medicineworker

    Comment

    • fran7
      New Member
      • Jul 2006
      • 229

      #3
      Dear medicineworker, Thanks just what I needed.
      Great
      Richard

      Comment

      Working...