Mixing URI & HOST (solved?)

Author Message

Andreas Kaiser

Friday 17 April 2009 4:46:17 am

Sometime we have a ez publish install with multiple sites and multiple languages, for example:

example.com/spanish
example.com/german
example.com/english

domain.com/es
domain.com/de
domain.com/en

because we have only one ez publish install we need to mix HOST (example.com & domain.com) and URI (spanish, german, etc).

In a lot of topics in the forum the answer is that it's not possible to mix HOST and URI. So HOST should be used for all siteaccesses (for example with subdomains): spanish.example.com, german.example.com, ..., es.domain.com, ...

Thanks to Tanta (Spain) we could configure a installation mixing host an uri. This is the site.ini file:

[SiteAccessSettings]
ForceVirtualHost=true
CheckValidity=false
AvailableSiteAccessList[]=example_spanish
AvailableSiteAccessList[]=example_german
AvailableSiteAccessList[]=example_english
AvailableSiteAccessList[]=domain_es
AvailableSiteAccessList[]=domain_de
AvailableSiteAccessList[]=domain_en

MatchOrder=uri;host
URIMatchType=map
URIMatchMapItems[]=spanish;example_spanish
URIMatchMapItems[]=german;example_german
URIMatchMapItems[]=english;example_english
URIMatchMapItems[]=es;domain_es
URIMatchMapItems[]=de;domain_de
URIMatchMapItems[]=en;domain_en
HostMatchMapItems[]=www.example.com;example_spanish
HostMatchMapItems[]=www.domain.com;example_es

This configuration for mixing URI & HOST works in our situation under ezp 4.1

Issues/situations we have found:

a.) URI access affects all HOST siteaccesses, for example in our example: "spanish" siteaccess would be shown in example.com & domain.com

b.) URI overrides url_alias, for example if we have an article named "spanish" in the root of a site the root page of the URI siteaccess is shown (not the article content)

eZ Partner in Madrid (Spain)
Web: http://www.atela.net/

André R.

Friday 17 April 2009 6:19:17 am

yes uri;host has been possible since 4.0.2.

a) yes, you will need apache rewrite rules or something to prevent that.

b) Then there is a bug, it should work like with module names, if there is a conflicting module name (as defined by ModuleList setting, witch is required as of 4.1), then url alias for that article is spanish2

The best would of course be to have a match type called hosturi or something, where combination of uri part and hostname decides the siteaccess to use, so you can do:
example.com/es
example.com/de
example.com/en

domain.com/es
domain.com/de
domain.com/en

We have patches for this (used at a customer install), and I'll try to get that into 4.2.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Andreas Kaiser

Friday 17 April 2009 8:30:04 am

Thanks Andre,

Your comment that this is an option since 4.0.2. explains it all!

So I hope that this topics help to clear that mixing uri and host is possible and will even get better :)

eZ Partner in Madrid (Spain)
Web: http://www.atela.net/

Luigi Spagnolo

Thursday 15 October 2009 7:53:47 am

@andrè:
"We have patches for this (used at a customer install), and I'll try to get that into 4.2. "

Has this been included in 4.2? If yes, how does it work?

André R.

Thursday 15 October 2009 12:07:32 pm

@Luigi: You can find a cleaned up version of the patch here on my comment:
http://issues.ez.no/IssueView.php?Id=15359&activeItem=3#comment262801

It's quite simple and works like you used to from host matching, expect that it also matches url of course. It came up a bit late in the 4.2 development cycle, so currently it is on hold.
There is also another patch from Felix there, so it would speed up the process if more people took a look at both and chimed in on the discussion there..

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Steven E. Bailey

Tuesday 30 March 2010 3:24:26 am

So did this make it into 4.3? Is there a better way of doing this in 4.3?

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Andy Caiger

Friday 13 August 2010 2:51:57 am

I'd also like to know if this was implemented in 4.3 or if there is a better way?

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

Steven E. Bailey

Friday 13 August 2010 4:28:58 am

If you look at the issue: http://issues.ez.no/IssueView.php?Id=15359 you'll see that it was implemented for 4.4.0alpha5... meaning it will be part of the core for the next release.

We have been using the patch that is offered in that issue and it works quite well.

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Andy Caiger

Monday 06 December 2010 12:48:38 am

Okay, we've upgraded our site so we can use the host_uri MatchOrder, but I can't understand how to use it to implement the above set-up that André has described above. site.ini says "Last optional parameter controls host matching method" but I can't understand what it does. What exactly should I put in site.ini to achieve:

[www.]example.com/es
[www.]example.com/de
[www.]example.com/en

[www.]domain.com/es
[www.]domain.com/de
[www.]domain.com/en

Thanks!

EAB - Integrated Internet Success
Offices in England, France & China.
http://www.eab.co.uk http://www.eab-china.com http://www.eab-france.com

Steven E. Bailey

Monday 06 December 2010 8:21:39 am

It should be something like this:

MatchOrder=host_uri;host;uri
HostUriMatchMethodDefault=part
HostUriMatchMapItems[]
HostUriMatchMapItems[]=site1.com;admin;site1_admin
HostUriMatchMapItems[]=site1.com;en;site1_en
HostUriMatchMapItems[]=site1.com;fr;site1_fr
HostUriMatchMapItems[]=site2.com;admin;site2_admin
HostUriMatchMapItems[]=site2.com;en;site2_en
HostUriMatchMapItems[]=site2.com;fr;site2_fr
HostUriMatchMapItems[]=site3.com;admin;site3_admin
HostUriMatchMapItems[]=site3.com;en;site3_en
HostUriMatchMapItems[]=site3.com;fr;site3_fr
HostUriMatchMapItems[]=site4.com;admin;site4_admin
HostUriMatchMapItems[]=site4.com;en;site4_en
HostUriMatchMapItems[]=site4.com;fr;site4_fr

take a look at the default site.ini of the 4.4 release for explanations.

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.