Multiple-site support

The core supports multiple sites running on the same web account and ProcessWire installation, with each site maintaining its own database and /site/ directory. This section outlines how to install multiple sites on the same ProcessWire installation using this method.

Multiple-site support implies running multiple web sites at independent domains or subdomains from the same ProcessWire installation and web hosting account.

ProcessWire can support multiple site setups using various methods, and you'll find several techniques discussed in the forum. On this page we outline the two most common and recommended methods of supporting multiple sites.

The core supports multiple sites running on the same web account and ProcessWire installation, with each site maintaining its own database and /site/ directory (option #1). You can also run multiple sites from the same database by installing one of the Multisite modules (option #2).

If using ProcessWire 3.x, you might also be interested in multi-instance support, which is a different topic from this but may have some crossover, depending on your need.

Option #1: multiple sites with multiple databases

This section outlines how to install multiple sites on the same ProcessWire installation, where each site has it's own database and /site/ directory (templates, modules, etc.)

Advantages

  • Sites remain independent from each other and thus highly organized and easy to maintain or move.
  • This method of multi-site support is built into ProcessWire's core and thus doesn't require installation of any other modules.
  • If your sites are different from one another in terms of design and function, then you'll find this approach may be preferable in keeping your site's templates, fields and modules more organized.

Disadvantages

  • Sites can't easily share data with each other, since they are running independently from one another.
  • Each site not only has it's own database, but it's own template files and 3rd party modules–this is an advantage or a distadvantage, depending on your needs.
  • If you need to maintain the same user accounts across all the sites, you'd have to maintain them individually on each.

How to install

Point another domain or subdomain to your current ProcessWire installation. When you access that domain or subdomain, it should load your existing ProcessWire site.

1. Create a subdirectory off of your web root called /tmp/ (or another name if you prefer). We will temporarily install a separate copy of ProcesWire there. So download and install a new copy of ProcessWire in that /tmp/ directory (run the installer by loading the /tmp/ URL in your web browser) . When it asks for database settings, make sure you are installing to a separate database than the one used by your main site. There is also an alternate version of step 1 further down, if you want to instead use a site that already exists.

2. Once installation has completed, move or rename the /tmp/site/ directory to a /site-name/ directory in your main ProcessWire installation. You may name the directory whatever you want, so long as it starts with "site-", i.e. "site-name", "site-something" or "site-cats"… whatever you want. Just don't call it /site/, as that is already there for your main site.

3. You may now delete the /tmp/ directory where you installed the other copy of ProcessWire–it is no longer needed.

4. Now you should just be left with your main site, but with the new /site-something/ directory. Copy or move the file /wire/index.config.php to /index.config.php (moving it into your web root).

5. Now edit that file with a text editor: /index.config.php. You will see instructions embedded in the file, follow them. To summarize those instructions, you will be telling ProcessWire to look for requests for your other domain or subdomain, and use the site installed at /site-something/ instead. Save.

6. Now access your alternate domain or subdomain in the browser. It should now be functional. To edit template files for this site, edit the files in /site-something/templates/. To edit pages for that site, login at the site's /processwire/ URL (at the newly added domain/subdomain).

Step 1 Alternate
You don't necessarily have to install a new copy of ProcessWire for step 1. If you have an existing site that you want to install instead, all you need is its /site/ directory and database. Using PhpMyAdmin or another tool, export the database from that site, create the new database, and import the data you exported. Then take the /site/ directory from your new site that you want to install and copy it to a /site-something/ directory where you want to install it (which is your ProcessWire installation where you want to support multiple sites). Once you've done that, edit the /site-something/config.php file and note the database information at the bottom. Edit it to be consistent with the database you created and imported.

Option #2: multiple sites from the same database

This option requires installation of the 3rd party Multisite module by Antti Peisa, or the newer 3rd party Multisite module by Soma. These modules may not be in active development at present, but are still applicable and useful starting points if you are interested in implementing this kind of multi-site support.

Advantages

  • All the individual sites or domains are running from the same database and thus can talk to each other. One site can pull data from another.
  • The sites can share the same templates, template files, fields and modules (an advantage or a disadvantage, depending on your needs).
  • All the user accounts are the same along the various sites. If you have the same team administering the individual sites, then this would be a major benefit.
  • Unlike option #1, you can and should re-use templates and fields where appropriate. If your multiple sites are similar in design and function, you may find this approach preferable to option #1.

Disadvantages

  • Your ProcessWire API usage must be coded in recognition of the multi-site environment, and thus one couldn't as easily move them out of this context as they could with option #1.
  • Requires installation of a 3rd party module, so you may have to be more careful in ensuring everything works through upgrades and such.
  • What is an advantage to this approach (sharing data) may be a disadvantage in keeping things organized long term. However, that can be easily solved with a little bit of discipline on your part in keeping things organized.
  • If your sites are not sharing the same templates to a large extent, you will have a lot more to keep track of [administratively] than if you kept them independent like in option #1. When you view your templates, fields and modules in the admin, you'll be viewing them for all the sites at once.

How to install

Installation instructions and support can be found on the Multisite forum thread.

Latest news

  • ProcessWire Weekly #549
    In the 549th issue of ProcessWire Weekly we’re going to check out the latest core updates, highlight one older yet still very relevant third party module, and more. Read on!
    Weekly.pw / 17 November 2024
  • Custom Fields Module
    This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
    Blog / 30 August 2024
  • Subscribe to weekly ProcessWire news

“We were really happy to build our new portfolio website on ProcessWire! We wanted something that gave us plenty of control on the back-end, without any bloat on the front end - just a nice, easy to access API for all our content that left us free to design and build however we liked.” —Castus, web design agency in Sheffield, UK