Converting from Single to Multi-Site

Automated Conversion

We recommend using the following command to convert from a single to multi-site installation:

php please multisite

Manual Conversion

If you wish to better understand how to manually convert from a single to multi-site installation, the steps are as follows.

Enable Multisite Config

First, enable multisite in your config/statamic/system.php:

'multisite' => true,

Adding New Sites

Next, you can add new sites through the control panel at /cp/sites, or directly in your resources/sites.yaml file:

default:
name: First Site
url: /
locale: en_US
second:
name: Second Site
url: /second/
locale: en_US

By default, the first site handle is named default, but feel free to rename it. This handle will be used below.

Update Default Site Content

Now you'll need to update your default site content file & folder structure, so that Statamic knows where to find it, now that you've enabled multi-site.

  1. For each collection:
    • Move all entries into a directory named after your default site's handle. (eg. content/collections/blog/*.md into content/collections/blog/default/*.md)
    • Add a sites array to the collection's yaml file with each site you want the entries to be available in.
  2. For each tree structure:
    • Take the root and tree variables, and move them in a file in a subdirectory named after your default site's handle. (eg. content/trees/navigation/pages.yaml to content/trees/navigation/default/pages.yaml)
    • Add a sites array to the root structure's yaml file with each site you want the structure to be available in.
  3. For each global set:
    • Take the values inside the data array, and move them to the top level in a file in a subdirectory named after the default site's handle. (eg. content/globals/pages.yaml to content/globals/default/pages.yaml)
    • Add a sites array to the root global's yaml file with each site you want the global to be available in.

At this point, your content will be available in the default site. You will need to localize each piece of content by following the steps in its respective documentation.

Note: If you don't add the sites to the respective container files, the site selector will not be visible in the control panel.

Clear The Cache

Finally, clear your cache!

php artisan cache:clear
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →