Create multisite in Gila CMS

Posted on March 24, 2021

You can build different websites using the same installation of Gila CMS. That helps you to reduce the time of maintanance (updates) and reduce of resources (disk usage). The different websites can use different databases and their own folders for the assets, but they share the same packages.

So you can have a main website, that occupies the root folders like /assets /tmp etc. and the other sites whose files are under /sites folder.

To create a new site, for example follow these steps:

  1. Create a folder sites/
  2. Create a config.php inside with the basic configuration (use default.config.php)
  3. Add folders assets/ tmp/ and log/

The folder should be something like that:


(Optional) To 'redirect' at you can duplicate the folder or create a link from the command lline of the server:

ln -s sites/ sites/

In order not to reveal files from the main website you should uncomment these lines at .htaccess file:

# from the root .htaccess redirect all domains except the main (localhost in this case)
RewriteCond %{HTTP_HOST} ^(.*)$ [NC]
RewriteCond %{HTTP_HOST} !^localhost$ [NC]
RewriteRule ^assets/(.*)$ sites/%{HTTP_HOST}/assets/$1 [NC]
RewriteRule ^tmp/(.*)$ sites/%{HTTP_HOST}/tmp/$1 [NC]


The manual of these steps should be updated in this document