Jump to content
fruid

multiple-site support on MAMP

Recommended Posts

I'm trying to install a multiple site installation as discussed here https://processwire.com/docs/more/multi-site-support/ 

Both sites are for the same client so I opted for option #1, different database, different web content, same PW installation.

I already had worked on both sites separately, so now I just want to move one site to the root folder of the other PW installation where the other site folder sits.

To my understanding, I need to change the config file to link to a different database and have different http-hosts.

My question is, how do I get it to run on MAMP? In my htdocs folder I can only choose the main folder (in which both site-folders sit) and when I open that one it just shows me what's in site, not what is in site-2.

thanks for help

Share this post


Link to post
Share on other sites

I have never used MAMP but the following setup should work...

Your MAMP htdocs folder (the one with wire inside), should have a structure like this.

site
site-blog
site-another
site-dev
wire
.htaccess
composer.json
CONTRIBUTING.md
index.config.php
index.php
LICENSE.TXT
README.md

Note the index.config.php. Do you have that? Inside it reads:

Quote

If used, this file should be copied/moved to the ProcessWire installation root directory

Your index.config.php (that you moved/copied from wire/index.config.php)

<?php namespace ProcessWire;

/**
 * ProcessWire multi-domain configuration file (optional)
 *
 * If used, this file should be copied/moved to the ProcessWire installation root directory.
 *
 * ProcessWire 3.x, Copyright 2016 by Ryan Cramer
 * https://processwire.com
 * 
 */

if(!defined("PROCESSWIRE")) die();

/**
 * Multi-domain configuration: Optionally define alternate /site/ dirs according to host
 *
 * If used, this file should be placed in your web root and then edited as follows. 
 *
 * This function returns an array that should be in the format where the array key
 * is the hostname (including domain) and the value is the /site/ directory you want to use.
 * This value must start with 'site-', i.e. 'site-domain' or 'site-something'. This is to
 * ensure that ProcessWire's htaccess file can recognize and protect files in that directory.
 *
 * Note that if your site may be accessed at either domain.com OR www.domain.com, then you'll
 * want to include entries for both, pointing to the same /site-domain/ directory. 
 * 
 * Each /site/ dir has it's own /site/config.php file that should be pointing to a separate
 * database. You shouldn't have two different /site/ dirs sharing the same database. 
 *
 */
function ProcessWireHostSiteConfig() {
	return array(
		/*
		 * Some Examples (you should remove/replace them if used).
		 * Just note that the values must begin with 'site-'.
		 *
		 */
		 'mydomainblog.com' => 'site-blog',
		 'www.mydomainblog.com' => 'site-blog',
		 'anotherdomain.com' => 'site-another', 
      	 'dev.mydomain.com' => 'site-dev',
		 

		/*
		 * Default for all others (typically /site/)
		 *
		 */
		'*' => 'site',
	);
}

Each site* will have its own site/config.php, with the correct credentials. ProcessWire will do the rest. Of course, you need all your domains working first, even locally. E.g. dev.mydomain.local, etc. in your hosts file.

Edited by kongondo
  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...