Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 05:09:24 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155533 Posts in 21713 Topics by 7739 Members
Latest Member: audillino
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: My Multi-Site solution  (Read 1043 times)
psmith

Offline Offline

Posts: 13


« on: March 02, 2010, 05:27:28 AM »

I just wanted to share with everyone the solution I've put together which allows me to run multiple WB sites off of a single codebase. It requires SSH access.

1. Install your core copy of WB.  In my case, I installed it to /public_html/wb/
2. (Optional) Customize your core site settings as you want it to be setup as a starting point for all of your other sites.
3. Using phpMyAdmin or any other mySql administation tool, export a copy of your WB database.
4. Create a new database (and new database username) and import the core database you just exported.
5. Copy the following set of core files over to your new site directory. In my case, I copied these files over to /public_html/site/.

Code:
/media
/pages
/temp
/templates
/config.php
/index.php
/upgrade-scrpt.php
/.htaccess.txt

6. Update config.php in your new site directory to match the new database name and password you just created.
7. Using SSH, login to your server account and create symbolic links to the remaining directories:

Code:
/account
/admin
/framework
/include
/languages
/modules
/search

This is an example of the SSH command you would use for each directory while inside the /public_html/site directory :

Code:
ln -s ../wb/account ./account

8. Open config.php in the core installation folder and replace that code with the following:

Code:
$pattern = '/[\/]/';

$root = trim(dirname(__FILE__), '/wb');

$url = $_SERVER['PHP_SELF'];
$b = preg_split($pattern, $url);

require('/'.$root.'/'.$b[1].'/config.php');

And that's all there is to it.  I don't know if this is a great solution or not - maybe it's just quick and dirty - but it works!

It's important to note that this solution allows every site to have its own media, pages, and templates directory. Droplets and Modules are installed at a global level. SO, if you install a calendar module to the core site at the initial installation, every child site you make after that point will also have access to the SAME calendar module.

If you install a module to the core site AFTER you make a child site, each child site will have to have its database updated as well in order to make use of the new module.

This setup should theoretically work in any directory structure, as long as your symbolic links point to the right place.

I would appreciate any feedback from you if you have suggestions for improving this setup.

Regards,
Phil
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!