Yet another multi tenancy post im afraid. I just cant find a good solution to my problem, I have read all the great posts on multi tenancy for ASP MVC but I still need some good advice.
Im going to create a corporate presence for one of my customers. Their company structure is like a main company (ex. Acme Group Ltd.) which own several other companies (ex. Acme Holding Ltd, Acme Technology Ltd., Acme Maritime Ltd., etc.).
I want to use one ASP MVC project to serve as the container for all the sites to cut down on the code needed and to keep it DRY. I also want all the sites to use the same Membership DB.
My first thought was to make one controller folder for each sub-company and one root controller for the corporate main page. Then it would look like:
acme.com ("Corporate main page")
acme.com/Holding ("Acme Holding Ltd.")
acme.com/Maritme ("Acme Maritme Ltd.")
...
This structure is fine by me, but I also want the users of the website to access each sub-site based on their own separate domains, ex:
holding.acme.com (This should direct to "acme.com/Holding").
...
That would of course also work, but the thing is that I do not want the url to change when the user is directed to "acme.com/Holding". I would like it to still be "holding.acme.com", "holding.acme.com/About", "holding.acme.com/Contact", etc. instead of "acme.com/Holding/Contact", etc.
What would be the best practice to use in this particular project, any thoughts?
Keep it simple, use IIS URL Rewrite Module. You can set it up to rewrite acme-holding.com/*
URLs to acme.com/Holding/*
:
<rewrite>
<rules>
<rule name="Forward to acme.com">
<match url=".*" />
<action type="Rewrite" url="http://acme.com/Holding/{R:0}" />
</rule>
</rules>
</rewrite>
I wrote a blog on multi-tenancy that covers exactly what you are attempting here.:
http://jasonjano.wordpress.com/2010/02/22/multi-presentation-websites-for-c/
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With