Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Access methods

Based on a set of rules, eZ publish determines which siteaccess it should use every time it processes an incoming request. The rules must be set up in the global override for the site.ini configuration file: "/settings/override/site.ini.append.php". The behavior of the siteaccess system is controlled by the "MatchOrder" setting within the [SiteAccessSettings] block. This setting controls the way eZ publish interprets the incoming requests. There are three possible methods:

  • URI
  • Host
  • Port

The following text gives a brief explanation of the different access methods. Please note that the access methods can be combined. The documentation page of the "MatchOrder" directive reveals how this can be done.

URI

This is the default setting for the "MatchOrder" directive. When the URI access method is used, the name of the target siteaccess will be the first parameter that comes after the "index.php" part of the requested URL. For example, the following URL will tell eZ publish to use the "admin" siteaccess: http://www.example.com/index.php/admin. If another siteaccess by the name of "public" exists, then it would be possible to reach it by pointing the browser to the following address: http://www.example.com/index.php/public. If the last part of the URL is omitted then the default siteaccess will be used. The default siteaccess is defined by the "DefaultAccess" setting within the [SiteSettings] block. The following example shows how to set up "/settings/override/site.ini.append.php" in order to make eZ publish use the URI access method and to use a siteaccess called "public" by default:

...
[SiteSettings]
DefaultAccess=public
 
[SiteAccessSettings]
MatchOrder=uri
...

The URI access method is typically useful for testing / demonstration purposes. In addition it is quite handy because it doesn't require any configuration of the web server and the DNS server.

Host

The host access method makes it possible to map different host/domain combinations to different siteaccesses. This access method requires configuration outside eZ publish. First of all, the DNS server must be configured to resolve the desired host/domain combinations to the IP address of the web server. Secondly, the web server must be configured to trigger a virtual host configuration (unless eZ publish is located in the main document root). Please refer to the "Virtual Host Setup" part of the installation chapter for information about how to set up a virtual host for eZ publish. Once the DNS and the web server is configured properly, eZ publish can be set up to use different siteaccesses based on the host/domain combinations of the incoming requests. The following example shows how to set up "/settings/override/site.ini.append.php" in order to make eZ publish use the host access method. In addition, it reveals the basic usage of the host matching mechanism.

...
[SiteAccessSettings]
MatchOrder=host
HostMatchType=map
HostMatchMapItems[]=www.example.com;public
HostMatchMapItems[]=admin.example.com;admin
...

The example above tells eZ publish to use the "public" siteaccess if the requested URL starts with "www.example.com". In other words, the configuration files in "/settings/siteaccess/public" will be used. If the requested URL starts with "admin.example.com", then the admin siteaccess will be used. The example above demonstrates only a fragment of the host matching capabilities of eZ publish. Please refer to the reference documentation for a full explanation of the "HostMatchType" directive.

Port

The port access method makes it possible to map different ports to different siteaccesses. This access method requires configuration outside eZ publish. The web server must be configured to listen to the desired ports (by default, a web server typically listens for requests on port 80, which is the standard port for HTTP traffic). In addition, the firewall will most likely have to be opened so that the traffic on port 81 actually reaches the web server. The following example shows how to set up "/settings/override/site.ini.append.php" in order to make eZ publish use the port access method. It also shows how to map different ports to different siteaccesses.

...
[SiteAccessSettings]
MatchOrder=port
 
[PortAccessSettings]
80=public
81=admin
...

The example above tells eZ publish to use the "public" siteaccess if the requested URL is sent to the web server using port 80. In other words, the configuration files inside "/settings/siteaccess/public" will be used. If the URL is requested on port 81 (usually by appending a :81 to the URL, like this: http://www.example.com:81), then the admin siteaccess will be used.

Balazs Halasy (02/02/2005 3:16 pm)

Svitlana Shatokhina (11/08/2006 9:36 am)

Balazs Halasy, Svitlana Shatokhina


Comments