-2

I am creating an ASP.NET MVC website in which I require a number of different sections such as admin, current deliveries, an inventory of products, etc. Would it be more beneficial, a subdomain for each different section, for example:

admin.mywebsite.com

or using this sort of routing:

mywebsite.com/admin

Which would be better design?

  • My guess is that the downvotes is due to you seem to be asking if it is a good idea to try to work around how the routing in asp mvc is implemented instead of using it as it is implemented. That isn't a good idea. I suggest that you focus on how controllers and views work in asp mvc, then you'll understand that they handle your sections very well. – Bent Jan 2 '18 at 10:23
2

There is no clear technical reason to prefer either choice. Instead, marketing, SEO, and UX considerations should drive this decision.

There are some technical reasons clearly in favour of subdomains:

  • if you want different HTTPS certificates for your subdomains.
  • if you need separate scopes for cookies or CORS policies.
  • if the subdomain points to a legacy website that cannot rewrite its URLs to work under a route.

All of these are fairly niche and are unlikely to occur in a greenfield project, but if they apply then the choice is clear.

Otherwise, using a single domain with routes for different sections is a sane default. This is likely to be simpler for you and also likely to be simpler for your users if they perceive your different sections as cohesive parts of the same website.

Certain considerations are not a factor for your URL structure, for example how you want to deploy your servers. If you use a single domain then a gateway server can dispatch requests to the correct backends. And if you have different domains they can point to the same IP, using server name indication to disambiguate the domains. So either choice would allow for any deployment scheme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.