1. Go to this page and download the library: Download buildrr/multisite library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// near the top of the file, outside of class AppView()
use BuildrrMultiSite\View\MultisiteView;
// inside of class AppView()
/**
* Overwrites Cake/View::_paths()
*
* @param null $plugin
* @param bool $cached
* @return mixed
*/
protected function _paths($plugin = null, $cached = true)
{
$multisite = new MultisiteView();
$multisite->theme = $this->theme;
return $multisite->_paths($plugin, $cached);
}
/**
* Map domains this install will support, to where that site's files are located.
* The incoming request domain is on the left, the folder within the sites
* directory that the request maps to is on the right.
*/
$domains['example.com'] = 'example.com';
$domains['example-app.com'] = 'example-app-folder';
/**
* find the folder that is being requested by the domain
*/
if (!empty($domains[$_SERVER['HTTP_HOST']])) {
if (!defined('SITE_DIR')) {
// this is the site combined local and remote sites directory
define('SITE_DIR', 'sites/' . $domains[$_SERVER['HTTP_HOST']]);
}
}