官术网_书友最值得收藏!

Selecting a siteaccess using host or URI-based matching

As we saw in the first chapter, eZ publish can work using host or URI-based access.

Using the wizard, we selected the URI access method. This can be changed, if necessary, 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.

URI

This is the default setting for the MatchOrder directive, and is set by the setup wizard. When this access method is used, the name of the siteaccess that we want to use has to be the first parameter that appears after the index.php part of the requested URL.

For example, the following URL will tell eZ publish to use the panel siteaccess: http://packmediaproject/index.php/panel. If we want to use the ita siteaccess, then the URL that we have to call will be http://packmediaproject/index.php/ita. If nothing is used in the last part of the URL, then the default siteaccess will be used.

Setting the default siteaccess

The default siteaccess is defined by the DefaultAccess setting within the [SiteSettings] section. To change it, we have to open the /settings/override/site.ini.append.php file and make the changes highlighted here:

[SiteSettings]
DefaultAccess=ita
[SiteAccessSettings]
MatchOrder=uri 

The URI access method is very useful for the development/preview stage where changing the DNS server isn't very easy.

Host

The host access method makes it possible to map different host/domain combinations to different siteaccesses. This access method requires the configuration of the server and DNS (not eZ Publish). The DNS server must be configured to resolve the desired host/domain combinations to the IP address of the web server, and then the web server must be configured to trigger a virtual host configuration (unless eZ Publish is located in the main document root). Once these settings are 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.packmediaproject.com;eng
HostMatchMapItems[]=it.packmediaproject.com;ita

The example above tells eZ publish to use the eng siteaccess, if the requested URL starts with www.packmediaproject.com. If the requested URL starts with it.packmediaproject.com, the Italian version of the site will be used.

In the same way, we can configure HostMatchMapItems to use the admin panel and other languages. Using the host configuration is useful if we don't want to make the backend subdomain public, but want to make it internal to our network, or to support those sites that want to differentiate the languages instances with a dedicated subdomain.

主站蜘蛛池模板: 农安县| 富宁县| 吴忠市| 和平区| 东宁县| 舒城县| 荥经县| 读书| 东港市| 余江县| 黎平县| 乐都县| 张掖市| 宣城市| 马尔康县| 富蕴县| 金乡县| 龙川县| 凤阳县| 栾川县| 洛扎县| 隆尧县| 河间市| 宾川县| 渭南市| 册亨县| 平舆县| 土默特左旗| 砀山县| 曲周县| 高州市| 文安县| 盐亭县| 峡江县| 临城县| 彩票| 冷水江市| 长兴县| 沙坪坝区| 禹州市| 杨浦区|