ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - Redirecting pages + 404  - FYI
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Redirecting pages + 404 - FYI

 Post Reply Post Reply
Author
Message
worldofrugs View Drop Down
Senior Member
Senior Member
Avatar

Joined: 24-April-2008
Location: United States
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote worldofrugs Quote  Post ReplyReply Direct Link To This Post Topic: Redirecting pages + 404 - FYI
    Posted: 03-June-2008 at 10:00am
For those interested:
I created some code to have old pages redirect to the new ones, including a custom 404 error page...
It will give nicely the status 301 (and 200) or 404 for the Search Engines...

So here's the code for all who like to use it:

<%@  language="VBScript" %>
<%
Dim Is301
Dim ResponseStatus
Dim SendTo
Dim QS
Dim PathInfo

Is301 = True
SendTo = "/productcart/pc/404.asp

QS = Trim("" & Request.ServerVariables("Query_String"))
If QS <> "" Then
PathInfo = Right(QS, Len(QS) - Instr(Instr(QS, Trim(Request.ServerVariables("SERVER_NAME"))), QS, "/") + 1)
Select Case LCase(PathInfo)
    Case "/contact.html"
             SendTo = "/productcart/pc/Contact.asp"
     Case "/news.html"
            SendTo = "/productcart/pc/News.asp"
    Case Else
                Is301 = False
End Select

If Is301 Then
    Response.Status =  "301 Moved Permanently"
    Response.AddHeader "Location", "http://" & Trim(Request.ServerVariables("SERVER_NAME")) & SendTo
Else
    Response.Clear
    Response.Status =  "404 Not Found"
End If
End If
%>
' write your html OR asp code here



Edited by worldofrugs - 11-June-2008 at 3:36pm
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.055 seconds.