Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Thanked 0 Times in 0 Posts

    Dynamic 301 redirect based on url.

    Hello all. I've been trying to figure out a redirect system for a site that I'm updating from classic asp to asp.net.

    Currently, the site has some product search and product detail pages such as:

    Well, what I want to do is create a 301 redirect from those pages to the new one, based on the idCategory parameter or the idproduct parameter.

    I found neat little 301 redirect code

    <%@ Language=VBScript %>
    Response.Status="301 Moved Permanently" Response.AddHeader "Location", " http://www.new-url.com"

    But I want to create a series of IF/Then statements that will redirect based on the uri parameter, and I'm not sure how to do it.

    In other words, my logic is -

    If WEBSITE uri = ../prodView.asp?idproduct=55
    Response.Status="301 Moved Permanently" Response.AddHeader "Location", "new-url(dot)com"

    I have to do this one line at a time because the Product ID's and the Category ID's will change with the new asp.net application.

    In any case, any ideas? I've never written code from scratch, that's why I stink at this.

    Thanks ahead of time.

  • #2
    Senior Coder
    Join Date
    Nov 2002
    North-East, UK
    Thanked 0 Times in 0 Posts
    You don't know how to do If/Else validation?
    See here (Assuming you are using ASP VBScript)

    A better way would be to use URL Rewriting/Redirecting.

    You can install components such as ISAPIRewrite and use a regular expression to redirect your URLs.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts