We have several different domains hosted on an in-house server. They all represent different brands owned by our company and we would like integration between each domain, sharing models, views, resources etc.
What I’d like to do is have {Controller} as the actual domain so it would look like http://{Controller}.com/{Action}/{Id}.
Is this possible? I’ve seen people do it with sub-domains.
AND, is it worthwhile or is there an easier way to accomplish the same.
If so, does anyone have any suggestions on how I can test this on Localhost?
Yes, it’s possible and not all that different to routing based on sub-domains. If you look at this example, he looks at the
Hostheader, splits on the ‘.’ and then takes the first element in the array. You’ll simply be taking the second-last element in that array (since “com” is the last element). Basically, in yourGetRouteDataoverride, you do something like this:(error-checking and validation not included here, obviously)
As for testing on localhost, you can simply add the domain names you want to test to your hosts file, pointing at 127.0.0.1.