General

  eZ Systems Website
  Editor documentation


  Developer documentation

  Back to the top

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

eZ Platform allows you to maintain multiple sites in one installation using a feature called siteaccesses.

In short, a siteaccess is a set of configuration settings that is used when the site is reached through a specific address.

When the user accesses the site, the system analyzes the uri and compares it to rules specified in the configuration. If it finds a set of fitting rules, this siteaccess is used.

 

What does a siteaccess do?

A siteaccess overrides the default configuration. This means that if the siteaccess does not specify some aspect of the configuration, the default values will be used. The default configuration is also used when no siteaccess can be matched to a situation.

A siteaccess can decide many things about the website, for example the database, language or var directory that are used.

 

How is a siteaccess selected?

A siteaccess is selected using one or more matchers – rules based on the uri or its parts. Example matching criteria are elements of the uri, host name (or its parts), port number, etc.

For detailed information on how siteaccess matchers work, see Configuration : Siteaccess Matching.

 

What can you use siteaccesses for?

Typical uses of a siteaccess are:

  • different language versions of the same site identified by a uri part; one siteaccess for one language
  • two different versions of a website: one siteaccess with a public interface for visitors and one with a restricted interface for administrators

 

Both the rules for siteaccess matching and its effects are located in the main app/config/ezplatform.yml configuration file.

 

Use case: multilanguage sites

A site has content in two languages: English and Norwegian. It has one URI per language: http://example.com/eng and http://example.com/n or. Uri parts of each language (eng, nor) are mapped to a siteaccess, commonly named like the uri part: eng, nor. Using semantic configuration, each of these siteaccesses can be assigned a prioritized list of languages it should display:

  • The English site would display content in English and ignore Norwegian content;
  • The Norwegian site would display content in Norwegian but also in English if it does not exist in Norwegian.

Such configuration would look like this:

Code Block
ezpublish:
	siteaccess:
		# There are two siteaccess
		list: [eng, nor]
 
		# eng is the default one if no prefix is specified
        default_siteaccess: eng

		# the first URI of the element is used to find a siteaccess with a similar name
        match:
		    URIElement: 1


ezpublish:
	# root node for configuration per siteaccess 
	system:
		# Configuration for the 'eng' siteaccess
        eng:
			languages: [eng-GB]
        nor:
            languages: [nor-NO, eng-GB]

The default scope

When no particular context is required, it is fine to use the `default` scope instead of specifying a siteaccess.