5

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.

Omar
  • 39,496
  • 45
  • 145
  • 213
Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
  • Why do you believe that having two sites is of benefit to SEO rather than putting all your 'link-juice' into a single domain? Do they have the same content on them or different content? If they have the same content do you specify canonical URLs? – Ian Mercer Apr 15 '10 at 00:23
  • When you say 'redirect to corresponding page' how is that mapping handled? Is there an MVC route for the old URL path that maps onto the new controller/action that handles it? Or are you wanting to do a permanent redirect from old URL structure to new? – Ian Mercer Apr 15 '10 at 00:24
  • Which version of IIS are you on, is the IIS7.5 Application and Request Routing module an option? – Ian Mercer Apr 15 '10 at 00:25
  • @hightechrider just switched to IIS7.0 – Simon_Weaver Apr 15 '10 at 01:39
  • @hightechrider - i'm hoping google would give a separate entry in results for store.example.com. since I wrote this question the old shopping cart is completly defunct - so you can forget about any legacy mapping. this is more about how in MVC can you map a domain to an area - if its feasible or not. i'm scared to do any external URL rewriting because i think MVC needs to know about whats going on to be able to generate the correct URLS – Simon_Weaver Apr 15 '10 at 01:41

1 Answers1

5

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.

Ian Mercer
  • 38,490
  • 8
  • 97
  • 133