Orchard Hungary is an archive

This site is now an archive. We'll keep it so the content is accessible, but we won't update it anymore. However, we frequently publish Orchard-related news on our other site Orchard Dojo, so be sure to check that out instead. And if you're interested in news about our Orchard development company, Lombiq, check out our website.

Orchard multitenancy development done easily

Tags: Orchard, multitenancy, testing, localhost

Orchard multitenancy is cool if you want to manage multiple sites in a single hosting environment where all the sites are "small" or doesn't require an extensive amount of custom and/or solely used modules or themes. Now of course you have to test tenants somehow locally too, so first you read the appropriate documentation page. But it can be even easier!

Suppose you have set up a tenant under your main site, e.g. english.orchardproject.hu and you run your site with Visual Studio's built-in devserver Cassini (IIS is not needed for most of the cases). What you have to do to access your tenant locally is simply edit Windows's hosts file (what is under Windows\System32\drivers\etc) and add the 		english.orchardproject.hu

line. This way if you open english.orchardproject.hu together with the port number you've got set up under the Orchard.Web project's properties under Web settings you'll see the local instance.

If you want to opt out and look at the live site, just comment out the line with a hash:

# 		english.orchardproject.hu

This approach doesn't require you to alter the tenant url configuration, but there is an even simpler solution if you have no problem with modifying the url for local testing:

Set the tenant's url to e.g. english.127-0-0-1.org.uk. If you open this url now you'll also see the local instance, as the 127-0-0-1.org.uk domain magically loops back to localhost. Don't forget the port number here either, e.g.: english.127-0-0-1.org.uk:651

Also keep in mind that you can specify multiple urls in the Settings.txt files of the tenants: simply list them, separated by commas (and no spaces) at the RequestUrlHost property.

<ShamelessPlug>If you happen to need hosting multiple sites with a finite set of themes, all sites requiring just a little amount of design customization you should definitely try the cool Theme Override module, whose author I happen to know closely.</ShamelessPlug>

Happy tenant testing!

No Comments