-
Notifications
You must be signed in to change notification settings - Fork 9
Multisite
Joomlatools Pages has build in multi-site support, and allows to add additional sites, which is a great way to use a single Joomla installation to create different mirco-sites, landingpages or squeezepages ...
The multisite feature makes it also possible to configure the root Pages directory /joomlatools-pages and point it to a custom location.
To re-configure the default site you need to add a configuration-pages.php to your Joomla root, or in case of Joomlatools Platform to /config directory. The configuration will re-define the location of your site:
<?php
return array(
'sites' => [
'[*]' => JPATH_ROOT.'/sites/mysite.com',
],
);The default value for the sites config option is [*] => JPATH_ROOT.'/joomlatools-pages'
To add additional sites a route for each site need to be added that resolves the URL to a directory on the file system.
For example to add an example.com and a intranet.example.com site you can use the following routes:
<?php
return array(
'sites' => [
'[www.]?exmample.com/shop[*]' => JPATH_ROOT.'/sites/shop'
'[www.]?example.com[*]' => JPATH_ROOT.'/sites/site',
'intranet.exmample.com[*]' => JPATH_ROOT.'/sites/intranet'
],
);- Routes are resolved in FIFO order. The first defined route is resolved first, if it cannot be resolved the next route is used, and so on.
- Routes are resolved against the HOST + PATH information of the URL. The url schema eg,
http://orhttps://should be omitted from the route, otherwise it will not resolve.
-
[*]will match up to the next trailing slash, it ensure that bothexample.com,example.com/andexample.com/pathare matched. -
[www]?ensures that bothwww.example.comandexample.comare matched.
See also: URLs and Linking > Routes > Wildcards
Note: You can add additional global configuration options to configuration-pages.php. You can still override the options per site in the sites config.php
Instead of defining a single route per site, it's possible define a route that can route multiple domains. For example to dynamically route all subdomains you can use the following route:
<?php
return array(
'sites' => [
'[alpha:site].example.com[*]' => JPATH_ROOT.'/sites/[:site]',
],
);-
[alpha:site]is a named wildcard that matches the domain. It will only match alphabetic subdomains, and it will not matchexample.com
See also: URLs and Linking > Routes > Wildcards
The multi-site support only works for content and data managed through Joomlatools Pages, and thus stored on the filesystem, it's not able to create a full multi-site environment in Joomla.
Got a question or need help? We have a forum on Github Discussions where you can get in touch with us.