Provides a web interface to run a Drupal multisite setup so additional sites can exist in subdirectories such as http://example.unl.edu/site2.
- Insert the following line into index.php after $request is initialized:
require_once './modules/contrib/unl_multisite/bootstrap.inc';
Your index.php file should look like:
$request = Request::createFromGlobals();
require_once './modules/contrib/unl_multisite/bootstrap.inc';
$response = $kernel->handle($request);
-
Copy .htaccess-subsite-map.txt.sample to the web root and rename to .htaccess-subsite-map.txt
-
Set the location of your config directory in sites/default/settings.php - See Drupal.org for help
$settings['config_sync_directory'] = '../config/sync';
- Copy sites/example.sites.php to sites/sites.php and add this to the end of the file:
/**
* Stub for the unl_multisite module to generate site aliases.
*/
# THIS SECTION IS AUTOMATICALLY GENERATED
# DO NOT EDIT!!!!
# %UNL_CREATION_TOOL_STUB%
# END OF AUTOMATICALLY GENERATED AREA
- Add this to .htaccess at the web root (inside the block).
# START unl_multisite SECTION
# Add the following line to your httpd.conf where <DRUPAL_ROOT> is the file system path to the Drupal web root.
# RewriteMap drupal_unl_multisite txt:<DRUPAL_ROOT>/.htaccess-subsite-map.txt
# Do not uncomment the previous line.
RewriteRule .*/cron.php cron.php
RewriteRule .*/update.php update.php
RewriteRule ^(.*?/(core\/assets|core\/misc|core\/modules|core\/themes|libraries|modules|sites|themes))(.*) ${drupal_unl_multisite:$1|$1}$3 [DPI]
RewriteCond ${drupal_unl_multisite://%{HTTP_HOST}%{REQUEST_URI}|NOT_FOUND} !^NOT_FOUND$
RewriteRule (.*) ${drupal_unl_multisite://%{HTTP_HOST}%{REQUEST_URI}|$1} [R,L]
# END unl_multisite SECTION
- Add the following line to your Apache's configuration file (httpd.conf) where <DRUPAL_ROOT> is the file system path to the Drupal web root. Restart Apache afterward.
RewriteMap drupal_unl_multisite txt:<DRUPAL_ROOT>/.htaccess-subsite-map.txt
-
Set up a cron job on the server to execute unl_multisite/cron.php on a regular basis.
-
Ensure the MYSQL database user for the default site has privileges to create new databases.
- Drush and MariaDB 10.7+ don't work with a database port set if the host is localhost. If you are using localhost for the host, clear the port setting in settings.php.