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

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?
 
R

RSH

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
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top