Note: This isn't specifically a module in the traditional sense, but it is an optional capability that you can enable so it seemed to make sense to include it in the modules section of the documentation.
ProcessWire can support multiple site setups using various methods, and you'll find several techniques discussed in the forum. 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.
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 fies for this site, edit the files in /site-something/templates/. To edit pages for that site, login at the site's /processwire/ URL.
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.
Post a Comment
All fields are required. Your e-mail is kept confidential and not included with your comment.