Let say we have one main domain, andfour sub domain, also, we have to develop them all to French andEnglish. The structure as below:
main www.example.com
child_one child_one.example.com
child_two child_two.example.com
child_three child_three.example.com
child_four child_four.example.com
Sine then, multi sub domain with multilanguage, so we will build 8 siteaccess.
1. Prepare for the environment of the server
1.1 Modify the host file.
127.0.0.1 example.com
127.0.0.1 child_one.example.com
127.0.0.1 child_two.example.com
127.0.0.1 child_three.example.com
127.0.0.1 child_four.example.com
1.2 Modify the httpd.conf of the apache to set upthe virtual host
<VirtualHost *:80>
<Directory "/var/www/example">
Options FollowSymLinks
AllowOverride all
Allow from all
</Directory>
<IfModule mod_php5.c>
php_admin_flag safe_mode Off
php_admin_value register_globals 0
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_valueallow_call_time_pass_reference 0
</IfModule>
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule content/treemenu/?/index_treemenu.php [L]
Rewriterule ^/var/storage/.* - [L]
Rewriterule ^/var/[^/]+/storage/.* -[L]
RewriteRule ^/var/cache/texttoimage/.*- [L]
RewriteRule^/var/[^/]+/cache/texttoimage/.* - [L]
RewriteRule^/var/[^/]+/cache/public/.* - [L]
Rewriterule^/design/[^/]+/(stylesheets|images|javascript)/.* - [L]
Rewriterule ^/share/icons/.* - [L]
Rewriterule^/extension/[^/]+/design/[^/]+/(stylesheets|images|flash|javascripts?)/.*- [L]
Rewriterule^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule^/packages/styles/.+/thumbnail/.* - [L]
RewriteRule ^/favicon\.ico - [L]
RewriteRule ^/robots\.txt - [L]
# Uncomment the following lines whenusing popup style debug.
# RewriteRule^/var/cache/debug\.html.* - [L]
# RewriteRule^/var/[^/]+/cache/debug\.html.* - [L]
RewriteRule .* /index.php
</IfModule>
DocumentRoot "/var/www/example"
ServerName example.com
ServerAlias example.comchild_one.example.com child_two.example.com child_three.example.comchild_four.example.com
</VirtualHost>
Note: After modifying the httpd.conffile, remember to restart the apache!
2. Set the settings of eZ publish
2.1 Create and set the global settings
In the direciton settings/override,create a file “site.ini.append.php”, here is an example ofsettings
<?php /* #?ini charset="utf-8"?
[DatabaseSettings]
DatabaseImplementation=ezmysqli
Server=127.0.0.1
Port=
User=root
Password=
Database=example
Charset=
Socket=disabled
[ExtensionSettings]
ActiveExtensions[]=example
ActiveExtensions[]=ezie
ActiveExtensions[]=ezoe
ActiveExtensions[]=ezodf
ActiveExtensions[]=zz_developer
ActiveExtensions[]=ezjscore
ActiveExtensions[]=ezfind
ActiveExtensions[]=customsurvey
ActiveExtensions[]=ezgoogleanalytics
ActiveExtensions[]=ezscriptmonitor
ActiveExtensions[]=ezsurvey
ActiveExtensions[]=recaptcha
ActiveExtensions[]=swark
ActiveExtensions[]=ezsiteaccessoperator
[Session]
SessionNameHandler=custom
[SiteSettings]
SiteName=example
DefaultAccess=main_fre
SiteList[]=main_fre
SiteList[]=main_eng
SiteList[]=child_one_fre
SiteList[]=child_one_eng
SiteList[]=child_two_fre
SiteList[]=child_two_eng
SiteList[]=child_three_fre
SiteList[]=child_three_eng
SiteList[]=child_four_fre
SiteList[]=example_admin
[FileSettings]
VarDir=var/example
[SiteAccessSettings]
CheckValidity=false
AvailableSiteAccessList[]=main_fre
AvailableSiteAccessList[]=main_eng
AvailableSiteAccessList[]=child_one_fre
AvailableSiteAccessList[]=child_one_eng
AvailableSiteAccessList[]=child_two_fre
AvailableSiteAccessList[]=child_two_eng
AvailableSiteAccessList[]=child_three_fre
AvailableSiteAccessList[]=child_three_eng
AvailableSiteAccessList[]=child_four_fre
AvailableSiteAccessList[]=child_four_eng
AvailableSiteAccessList[]=example_admin
ForceVirtualHost=true
RemoveSiteAccessIfDefaultAccess=enabled
RequireUserLogin=false
RelatedSiteAccessList[]=epam_fre
RelatedSiteAccessList[]=epam_eng
RelatedSiteAccessList[]=pro_fre
RelatedSiteAccessList[]=pro_eng
RelatedSiteAccessList[]=public_fre
RelatedSiteAccessList[]=public_eng
RelatedSiteAccessList[]=projects_fre
RelatedSiteAccessList[]=projects_eng
RelatedSiteAccessList[]=extranet_fre
RelatedSiteAccessList[]=extranet_eng
RelatedSiteAccessList[]=epamarne_fre
RelatedSiteAccessList[]=epamarne_eng
RelatedSiteAccessList[]=epam_site_admin
ShowHiddenNodes=false
[DesignSettings]
DesignLocationCache=disabled
[MailSettings]
Transport=SMTP
TransportServer=
TransportUser=
TransportPassword=
AdminEmail=david.li@bysoft.fr
EmailSender=
[TemplateSettings]
TemplateCache=disabled
TemplateCompile=disabled
TemplateOptimization=disabled
TemplateCompression=disabled
DevelopmentMode=enabled
[ContentSettings]
ViewCaching=disabled
StaticCache=disabled
[OverrideSettings]
Cache=disabled
[RegionalSettings]
TranslationCache=disabled
[RoleSettings]
UserPolicyCache=disabled
EnableCaching=false
[RSSSettings]
CacheTime=0
*/ ?>
2.2 Create all the sub domainsiteaccess
In the direction settings/siteaccess,webuild 10 folders as
main_fre
main_eng
child_one_fre
child_one_eng
child_two_fre
child_two_eng
child_three_fre
child_three_eng
child_four_fre
child_four_eng
Basicly, under all the folders, thereis a “site.ini.append.php”, the common content of XXX_fre as:
<?php /* #?ini charset="utf-8"?
[SiteSettings]
LoginPage=embedded
[UserSettings]
RegistrationEmail=
[DesignSettings]
SiteDesign=epam
AdditionalSiteDesignList[]=base
[RegionalSettings]
Locale=fre-FR
ContentObjectLocale=fre-FR
SiteLanguageList[]=eng-GB
SiteLanguageList[]=fre-FR
TextTranslation=enabled
[ContentSettings]
TranslationList=eng-GB
[DebugSettings]
DebugOutput=enabled
DebugRedirection=disabled
[TemplateSettings]
Debug=disabled
ShowXHTMLCode=disabled
ShowUsedTemplates=enabled
[DatabaseSettings]
SQLOutput=disabled
*/ ?>
Of course, there is another folder“example_admin” which is used for the admin, we don't payattention to it here.
2.3 Develop a extension for the developers
Build the zz_developer extension andlocate it under extension/zz_developer, the structure as below:
| | |~zz_developer/
| | | `~settings/
| | | |~siteaccess/
| | | | |~main_eng/
| | | | | `-site.ini.append.php*
| | | | |~main_fre/
| | | | | `-site.ini.append.php*
| | | | |~example_admin/
| | | | | `-site.ini.append.php*
| | | | |~child_one_eng/
| | | | | `-site.ini.append.php*
| | | | |~child_one_fre/
| | | | | `-site.ini.append.php*
| | | | |~child_two_eng/
| | | | | `-site.ini.append.php*
| | | | |~child_two_fre/
| | | | | `-site.ini.append.php*
| | | | |~child_three_eng/
| | | | | `-site.ini.append.php*
| | | | |~child_three_fre/
| | | | | `-site.ini.append.php*
| | | | |~child_four_eng/
| | | | | `-site.ini.append.php*
| | | | |~child_four_fre/
| | | | | `-site.ini.append.php*
| | | `-site.ini.append.php*
In thezz_developer/site.ini.append.php, we have the code:
<?php /* #?ini charset="utf-8"?
[SiteSettings]
SiteURL=example.com
[MailSettings]
AdminEmail=david.li@bysoft.fr
Transport=sendmail
EmailSender=
[SiteAccessSettings]
MatchOrder=uri;host
HostMatchMapItems[]=example.com;example_fre
HostMatchMapItems[]=child_one.example.com;child_one_fre
HostMatchMapItems[]=child_two.example.com;child_two_fre
HostMatchMapItems[]=child_three.example.com;child_three_fre
HostMatchMapItems[]=child_four.example.com;child_four_fre
*/ ?>
In the main_fre/site.ini.append.php andmain_eng/site.ini.append.php, by default, we have nothing in it, butin the child_one_fre/site.ini.append.php,child_one_eng/site.ini.append.php, child_two_fre/site.ini.append.php,child_two_eng/site.ini.append.php,child_three_fre/site.ini.append.php,child_three_eng/site.ini.append.php,child_four_fre/site.ini.append.php,child_four_eng/site.ini.append.php, we have different content.
For example, under thechild_one_XXX/site.ini.append.php, we have the code:
<?php /* #?ini charset="utf-8"?
[SiteSettings]
#child_one sub domain
IndexPage=/content/view/full/70/
RootNodeDepth=2
DefaultPage=/content/view/full/70/
*/ ?>
Note: Remember to change the node id toyour sub domain.
Ok, now we have builded the multi subdomain with multi language yet.