How to create multiple multilingual sites in one install?

Author Message

Marc Boon

Friday 13 January 2006 2:30:01 am

[Sorry for double posting, but I posted earlier in the wrong forum]

I'm currently evaluating eZ Publish for a rather large project with two multilingual sites using shared content.
I tried for a few days to set this up, but didn't find a complete solution. Can anybody help?

This is the situation:

site1.com/ # default (english) version of site1
site1.com/en/ # same as above
site1.com/de/ # german version of site1
site1.com/es/ # spanish version of site1
site1.com/admin/ # admin site for site1

site2.com/ # default (english) version of site2
site2.com/en/ # same as above
site2.com/fr/ # french version of site2
site2.com/ar/ # arabic version of site2
site2.com/admin/ # admin site for site2

I first tried a combination of host and uri matching (settings/override/site.ini.append.php):

[SiteAccessSettings]
MatchOrder=host;uri

But this doesn't work, because when a host match is found, the uri is not evaluated. The other way around also doesn't work:

MatchOrder=uri;host

When a uri match is found, the host is not evaluated, and you don't know which site the uri belongs to (both sites have /en/ for example).

Then I tried a combination of servervar and host matching, and using Apache to set the servervar (both sites have the same DocumentRoot):

MatchOrder=servervar;host
ServerVariableName=SITE_ACCESS
HostMatchType=map
HostMatchMapItems[]=site1.com;site1_en
HostMatchMapItems[]=site2.com;site2_en

The server variable is set by Apache using the SetEnvIf directive (using mod_setenvif):

In the <VirtualHost> section or .htaccess for site1:

SetEnvIf Request_URI ^/de/ SITE_ACCESS=site1_de
SetEnvIf Request_URI ^/es/ SITE_ACCESS=site1_es
SetEnvIf Request_URI ^/admin/ SITE_ACCESS=site1_admin

In the <VirtualHost> section or .htaccess for site2:

SetEnvIf Request_URI ^/fr/ SITE_ACCESS=site2_fr
SetEnvIf Request_URI ^/ar/ SITE_ACCESS=site2_ar
SetEnvIf Request_URI ^/admin/ SITE_ACCESS=site2_admin

When no language is specified, the server var SITE_ACCESS is not set, so the servervar match fails, and the host matching takes care of the default site access (MatchOrder=servervar;host).

Site access works now, but the language/admin part is interpreted as a module, with a 'module not found' error as a result. I tried fixing this using the PathPrefix setting, but that didn't work.

Any suggestions?

Montse Ortega

Friday 26 February 2010 12:43:05 am

Did you resolve this issue? I have the same problem and I can't resolve.

Thanks!

Madeline VEYRENC

Thursday 01 April 2010 6:49:33 am

Hi,
I find a solution to use servervar match order :
First, in your VHost, use this rules to set your variable :

SetEnvIf Request_URI ^/.* SITE_ACCESS=site1_en
SetEnvIf Request_URI ^/de.* SITE_ACCESS=site1_de
SetEnvIf Request_URI ^/es.* SITE_ACCESS=site1_es

You can also add this one :

SetEnvIf Request_URI ^/en.* SITE_ACCESS=site1_en

Do the same for the other VHost and create another VHost for the backend with this rule :

SetEnvIf Request_URI ^/ SITE_ACCESS=admin

Next, in settings/override/site.ini.append.php, put this conf :

[SiteAccessSettings]
MatchOrder=servervar
ServerVariableName=REDIRECT_SITE_ACCESS 

(Apache add 'REDIRECT_' before your variable)

Restart Apache and try.

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

eZ debug

Timing: Jan 18 2025 11:38:18
Script start
Timing: Jan 18 2025 11:38:18
Module start 'layout'
Timing: Jan 18 2025 11:38:18
Module start 'content'
Timing: Jan 18 2025 11:38:19
Module end 'content'
Timing: Jan 18 2025 11:38:19
Script end

Main resources:

Total runtime1.0916 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 588.2109152.6563
Module start 'layout' 0.00520.0026 740.867239.4922
Module start 'content' 0.00781.0824 780.3594527.7266
Module end 'content' 1.09020.0014 1,308.085912.7188
Script end 1.0916  1,320.8047 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2836160.0002
Check MTime0.00140.1251160.0001
Mysql Total
Database connection0.00090.079710.0009
Mysqli_queries1.035694.8648590.0176
Looping result0.00060.0571570.0000
Template Total1.061697.220.5308
Template load0.00170.158120.0009
Template processing1.059897.087820.5299
Template load and register function0.00020.014210.0002
states
state_id_array0.00080.077710.0008
state_identifier_array0.00200.183520.0010
Override
Cache load0.00150.1328480.0000
Sytem overhead
Fetch class attribute can translate value0.00120.110430.0004
Fetch class attribute name0.00150.133630.0005
XML
Image XML parsing0.00040.039630.0001
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00070.0668100.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
9content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 33
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs