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.
Known limitation
First level folders or other container objects in your content structure can't have the same name as the existing siteaccesses if you configured your site to use URL access method.
Considering an existing "ezflow_site" siteaccess exists, if you create a folder with the same name and try to access it using http://<your_site>/ezflow_site you will be redirected to the siteaccess instead on accessing your "ezflow_site" folder.
This is actually a known limitation of the URI siteaccess matching.
If you need to use first level folders or other container objects with the same name as any of your siteaccesses we suggest you to use hostname matching instead.
For more details on configuring hostname matching, please check the HostMatchMapItems documentation.
Balazs Halasy (14/09/2010 10:26 am)
Ricardo Correia (03/04/2013 11:03 am)
Comments
There are no comments.