Sunday, April 20, 2008

Mutiple Websites + Umbraco

In this short tutorial we are going to learn how to run multiple websites on one instance of Umbraco, this is fantastic if you have common features that you want share between many sites.

I've you followed my GST user control samples (Part 1 | Part 2)
then you will know I have an unusual obsession with GST and VAT calculators and this tutorial is not going to be any different.

In my quest for value added tax calculator dominance i registered two domain names and (mainly cos they were only .99c) and what I plan to do is run the calculator we developed in the User Control sample on both websites but only running 1 instance of Umbraco.

The first thing we needed to do was obviously point both domain names to our web server, I'll take it for granted you know how to do this.

Next we can either add both websites to an existing IIS website or create a new one in this case I've created a new website in IIS called Umbraco, pointed the "home directory" to my Umbraco installation and added host header in IIS as per screen shot below.

Because we are going to have a GST calculator(New Zealand) and a VAT Calculator (United Kingdom) we are going to want to have different regional settings eg $ instead of £. For this reason we need to make sure we have two languages defined.

Next we'ved added two new content pages, you can call these whatever you want, if you going to be running many websites then obvisouly it makes sense to name these something you are going to remeber, probably the easiest thing thing to do is call them their domain name.

Now we need add new hostnames to each of the pages we've just created - right mouse click and select host names

Enter the corresponding hostname make sure you add the www version as well.

We should all be set now - if you browse to each website you should see a different version (if you added some content to each page).

While writing this tutorial once i added the host names, Umbraco was still showing me the default homepage of another website higher in the tree, I tounched the web.config so the application would restart and this fixed the issue.

Hope you all enjoyed this tutorial!

No comments: