Migrating static site to ASP.NET - How to handle redirecting old URLs?

  • Thread starter Thread starter ITistic
  • Start date Start date
I

ITistic

I am about to start on a migration from a static HTML site to an
ASP.NET solution. I've done a ton of these in the past as my primary
job duty is developing ASP.NET sites. This is the first project I've
come across for a site that has quite a few .HTM pages with good
search engine ranking. I want to make sure I do everything I can to
retain those rankings at least as far as the URLs are concerned. What
I want to do is make sure that when an old .HTM URL is requested that
the system 301 redirects to the equivalent ASP.NET page. My initial
thought is to create a database table of all the OLD virtual URLs
(ex: /products/product1/index.htm) and the new ASP.NET URL that they
should be redirected to. I could then set ASP.NET to process .HTM
pages and use a custom 404 handler to perform the redirection. Is this
the best way? Even if you think it is, what other solutions have you
used that may be easier or better?
 
I have used redirects in IIS as well as custom redirects in the Global.asax
file basically error trapping the page not found error and forwarding them
to the new page.

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

strErr = Server.GetLastError.ToString()

If InStr(strErr, "System.IO.FileNotFoundException:") > 0 Then

If InStr(UCase(strErr), "\SERVICES\") > 0 Then

Response.Redirect("/EmployerSolutions_Main.aspx")

ElseIf InStr(UCase(strErr), UCase("\About\")) > 0 Then

Response.Redirect("/About.aspx")

ElseIf InStr(UCase(strErr), UCase("\Accountants\")) > 0 Then

Response.Redirect("/IndustrySolutions_AccountingProfessionals.aspx")

End Sub
 
just map .htm to asp.net and keep the same file names. there is nothing
really special about using .aspx, it just a convention

-- bruce (sqlwork.com)
 
Back
Top