help.axcms.netAxinom Logo
Save Save Chapter Send Feedback

Managing multiple sites

How to manage multiple sites with one CMS instance.


For managing multiple sites it is possible to install multiple instances of the AxCMS.net to the same server. These instances are completely independent of each other. There is no limitation for the number of installations on one server. All instances share single and the same IndexService and MailCenter.


Using the same content (pages, documents) and/or the same user-rights sets, it might be more convenient to manage these sites in a single instance of the AxCMS.net. The multisite-feature of the AxCMS.net is capable to manage different language versions of the same content. There are some services for implementing this feature.

Basic concepts

Using multi-site features, you create all pages (for all Sites) in the same CMS and structure them using the Navigation. We consider to define a naming convention for the pages (e.g. prefixes en_ and de_ for english and german Sites), even though this is not necessary.

First create so called Site Nodes: navigation nodes, serving as roots of your Sites. These nodes are never presented to the users, they only help to distinguish between the Sites.

Site Nodes are defined directly under the root of the Navigation tree (predefined node 6). In the examples below we will create a company presentation for three countries: USA (english), UK (english) and Germany (german).

Homepage resolution

For our example we define an own domain name for each site, like www.yourcompany.com, www.yourcompany.co.uk and www.yourcompany.de. All these names are to refer to the same Web-Server (where the AxCMS.net is installed), but a user should get to different entry points depending on the address he used. Therefor you have to associate the correct homepage with each site. To do this, follow these steps:

  • Define the DNS for all domains you want to use to refer to your site. They all have to refer to the IP-Address of your AxCMS.net-Server.

  • Define all host headers in IIS for your AxCMS.net Site. You have to define all names created in the previous step in the DNS.

  • Enter URLs that correspond to the respective Site to the field "Addition" (ExternID in the database) of each site node. You can use multiple URLs for the same Site. In this case, write all the names comma-separated (spaces allowed). E.g. www.yourcompany.com, yourcompany.com, cms.yourcompany.com.

  • Create a Homepage for each Site and associate it with the site node and define it as a standard page.

 

 

If you type www.yourcompany.com without specifying a page, the defaultMultisites.aspx is called. This page selects among all the site nodes the node, that has www.yourcompany.com in its Addition (ExternID) list. If found, it redirects to the page, associated to this site node. If not, it redirects to the pages, which have been specified in the web.config:

<appSettings>
   ...
   <add key="Homepage" value="/Homepage.AxCMS" />
   ...
</appSettings>

DefaultMultisites.aspx is the page, which the logic of the homepage solution is implemented to. Please define this page as the default document for the Live-System in the IIS, as shown on the screenshoot below.

Which Template to use?

If you have different layouts and different functionalites for different sites, it is recommended to create an own page template for each site. If the sites only differ by their content, you can reuse the same template for all sites. You have to develop the template the way, that it takes into account to which Site a Page belongs. For example, navigation controls should show the part of the tree beginning at the respective site node. As an alternative, you may want to use different style sheets for different Sites.

Site-Dependent Behaviour

To be able to develop in a behaviour-dependent mode on the current site, you have to know at runtime, at which site you are. The process works like this:

  • Find the currently requested page
  • Find the navigation node of the page
  • Find the site node, under which the navigation node is placed

This process is implemented in the class MultisiteContext and is transparent for you. You should just override the function CreateContext in your Template (better: BaseTemplate of your project) to return MultisiteContext-object:

protected override AxNavigationContext CreateContext()
{
return new MultiSiteContext();
}

After that you can access the properties Root and RootID of the MultisiteContext - it is exactly the site node for the current site (or its ID). Particularly you can use this method with your navigation control to find the right root for the navigation nodes:

((MultisiteContext) ((TemplateBase) this.Page).NavigationContext).RootID

Language Considerations

If you want different Sites to have the user interface in different languages, it is possible with AxCMS.net. You have to consider 3 aspects of the problem:

  • The language of the content
  • The language of the Site
  • The language of the user
  • Translation of the templates

Language of the content

The editor decides, which language is used for the content. AxCMS.net does not influence this. But AxCMS.net offers some features, which help working with content in different languages.

You can establish relations between pages, documents and categories. Thus you can create a relation between two arbitrary pages. It is useful to link similar pages in different sites/languages. If you have such relations, you can easily switch between these pages.

If you already have a page in one language and want to start working on another language version of it, you can save time on recreating page structures by copying the content of the existing page and then translate only the texts. Create a new page, save it (click Apply) and then "Copy content from". Select the source page. Content is copied into the new page. The relation named "Relation" is automatically created between old and  new page.

If you created your presentation in one language and now would like to copy the whole tree to start working with another language version, you can do it with a special stored procedure. This procedure must be customized for your project, a template is available from Axinom on request.

 

Defining the language of the site

If you want to switch the language of a site depending on the user, you have to save the matching, which language is used by each of your sites. The simplest way to do this, is to create a category for each language (e.g. German, English) and then categorize the site nodes with these categories. After that you can use this information to set the user language depending on the Site (see below).

 

Determining target language of the user

The translation module uses the language, set in Thread.CurrentUICulture of the current executing thread as target language. So this language should be set before the render-event of the page processing cycle. The usual way to set the language, is to write an HttpModule setting it. An HttpModule could set the language in different ways.

The BrowserLanguageModule, delivered with the AxCMS.net, reads the languages, passed from the browser and takes the first one. (If this language is not supported by the AxCMS.net, the default language, currently german, is used.)

Another implementation is FixedLanguageHttpModule. It reads an option from web.config and sets the language respectively. This simple module can be used, if your site uses only one language, different from the AxCMS.net-default language.

The next possibility is to write your own HttpModule. Such module could set the language, for example, depending on the site. The module should determine the site that the user is currently visiting, determine the language defined for this Site and set this language in the current thread.

Or you set Culture in InitContext function of your Context in your templates project.

 

Translation of the templates

Text, coded directly into your templates must be translated "on-the-fly". You can do this using resources and resource-DLLs (standard Microsoft approach for internationalization) or you can use the Axinom technology AxLanguage, which is also used for the translation of the AxCMS.net. Read more about AxLanguage at Multi-Language-Support in the AxCMS.net.