How do I make 301 redirects in asp.net from old Apache mod_rewrite style urls when moving a site from php to asp.net?

I have an existing site in php running on Apache using the mod_rewrite module. In other words, I currently have URLs like www.example.com/section/subsection/ that have been indexed by Google and others.

However, the site needs a major update and I would like to move it to asp.net. I have the option of using a shared hosting solution (iis 6, aps.net 3.5, full trust). So my question is, how do I make asp.net a 301 redirect from my old urls like www.example.com/section/subsection/ to their equivalents on the new asp.net site?

I clearly need to not lose my current search engine rankings.

Thanks, Egil.

+1


source to share


3 answers


According to the blog post by Steve Sanderson Deploying ASP.NET MVC for IIS 6 it doesn't look like there is an option to do url rewriting / redirection from IIS6 in a shared hosting setup where you can't manually configure IIS. G ...



0


source


If you are using the ASP.NET MVC framework, the URL rewriting system is built into it.

You can manually add 301 redirects to IIS using IIS Manager if you want to configure "roamed" locations.



If you want to rewrite the URL, you will need to implement the IHttpModule, hook up the BeginRequest event, and add this new class to the httpModules section in the Web.config.

+1


source


Ok ... so it might be overkill and could be done in a different way in two lines ... BUT ...

If you keep the same domain name, then what I've done in the past is keeping a table of old urls and how they map to new urls. In the application request, I scan the table, if the old url is found, then I will add a header that 301 redirects to the new url.

+1


source







All Articles