Forums / Install & configuration / How to create multiple multilingual sites in one install?

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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 Exponential 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.