Running Multiple Domains, Subdomains, or Subsites

It is possible to run ExpressionEngine so that content can be accessed from more than one location. This is often desired if you want to put different content on different subdomains or simply otherwise want to access your content through more than one location.

In order to allow this, you simply need to follow a few steps:

Copy index.php and path.php

You must place a copy of the main site path.php and index.php (the ones from your main directory, not from the system directory) files into the directory from which you wish to access ExpressionEngine.

The directory you specify must be able to have files within it be able to access your main installation system directory. You should ensure you don't have any "open_basedir" or other restrictions in place which could prevent this.

If you want, you may rename the index.php file as described on the Renaming Main Site File page.

Edit path.php

Once you've copied the files, you must open path.php to edit it.

$system_path

First, you must ensure that the $system_path variable is set correctly within the file. The variable should contain a relative path from the current directory (in which the path.php file resides) to your site's system directory. For instance:

$system_path = "../system/";

Add New Variables

Second, you must add several new variables to the file:

$template_group = "template_group_name";
$template = "template_name";
$site_url = "http://www.your-site.com/subdirectory/";
$site_index = "index.php";
$site_404 = "template_group_name/template_name";

The variables are:

Optional Variables

You may specify a PHP array containing "global variables" that will be available only to Templates accessed through that path.php file.

$global_vars = array(); // This array must be associative

For instance, let's say you want to define a weblog name and a Template Group name. You could use this:

$global_vars = array(
"my_weblog_name" => "news",
"my_template_group" => "display"
); // Last entry must not include the comma at the end

Within your Templates, you would then be able to use the {my_weblog_name} and {my_template_group} variables.

Top of Page