#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Url Redirection In ASP


    I have a website in asp, I am moving old website to new website in asp only which is having new template, new links etc.
    For both old and new website the back end is SQL SERVER 2008.
    But as my old website links are live in google, so I want to redirect all the old links of the old site to the new links of the new site, so that old links should not treated as NOT FOUND or broken links in Google.
    How to implement this in ASP.
    Please provide me the reference to solve this issue.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    21
    Rep Power
    0

    redirect in html


    if your old pages are html, then add a meta tag like this in the head:

    Code:
    <meta http-equiv="REFRESH" content="0; url=http://www.google.com" />
    if your old pages are .aspx files, then replace all code in that file with this code:

    Code:
    <%@ Page Language="VB" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
        Private Sub Page_Load(sender As Object, e As EventArgs)
            If (Response.IsClientConnected) Then
                Response.Redirect("http://www.google.com", False)
            Else
                Response.End()
            End If
        End Sub
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <title></title>
    </head>
    <body>
    </body>
    </html>

IMN logo majestic logo threadwatch logo seochat tools logo