![]() |
Redirecting pages + 404 - FYI |
Post Reply ![]() |
Author | |
worldofrugs ![]() Senior Member ![]() ![]() Joined: 24-April-2008 Location: United States Status: Offline Points: 0 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |