Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Map a domain to an MVC area

Tags:

Anybody got any experience in mapping a domain to an MVC area?

Here's our situation:

Old system (still active but will soon redirect to new store):

www.example.com - our main site where we send traffic
store.example.com - our store site which is a completely separate site that is indexed in google

New system:

www.example.com - same site as before
www.example.com/store - new store site - built in an ASP.NET MVC area

Because store is a separate domain google gives it a separate entry in the search results. I'd like to keep this benefit in future but wondering whether or not there is a good way to map a domain (store.example.com) to the MVC area or if its just going to be more trouble than its worth.

PS. I'm not trying to keep existing indexing - its a completely separate store so thats not possible. I just want to redirect to the corresponding page in the new store. I'm just trying not to lose the benefit of two domains for SEO purposes.

like image 459
Simon_Weaver Avatar asked Jan 29 '10 23:01

Simon_Weaver


1 Answers

I would use URL Rewriting, either in ASP.NET or in IIS7 Application and Request Routing (ARR) to change incoming requests for store.example.com/... to example.com/store/....

MVC will have no issue with this - it doesn't get to see anything but the new URL and it will generate links only for the new layout.

Other alternatives:

  1. Create a website for the store.example.com that just does a wildcard 301 redirect for each page to the corresponding page on the new site.

  2. If the URLs don't overlap at all, point the old domain to the new MVC site and add duplicate routes for each action, e.g. shop.example.com/info.aspx?item27 might have a route "/info.aspx/{pathinfo*}" ... which loads an Action that knows how to handle the old URL parameters and can do a Redirect to the new Action.

I have sites where there are many URLs mapped onto the same Action - in fact, every legacy URL that has ever been used for a page still works today, including even the old .ASPX URLs which are now served up by an MVC Action. Some legacy URLs are dealt with using a 301 response, others which legitimately have duplicate content on the site are handled as normal but the page also includes a canonical URL to point out which one is the preferred URL.

like image 81
Ian Mercer Avatar answered Oct 12 '22 09:10

Ian Mercer