Migrate HTML Site to ASP.NET MVC 3
I have just ported an HTML site over to ASP.NET MVC 3.
Google appears to have a lot of the old pages indexed, e.g.
http://www.foo.com/bar.html
and now this will be
http://w开发者_StackOverflow社区ww.foo.com/bar
I'd like a way to force users and Google to be permanently redirected to the new URL structure. Some of the redirects aren't as simple as dropping the .html, so the ability to fine-tune the redirect paths would be great.
I'm hosting on Windows Server 2008 R2, so if I can do this through IIS then great, else I don't mind implementing something in code.
Any ideas please?
I've had a hunt round Google, but not found anything that seems to fit the bill.
Thanks.
I'd set up a catch-all route and a Redirects
table in your DB. In a catch-all handle I'd check if there's an entry for a requested URL in the Redirects
and redirect to a new URL.
have you allready tried to add additonal routes to your routing table. here is an article that describes routing in mvc.
http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx
精彩评论