Hi, I'm ThadeusB.

I code stuff. I raise bees. I game.

One Wordpress, One Database, Multiple Domains

Edit your wp-config.php file and set your table prefix to the address of the domain

In this example the table prefix would come from http://blog.thadeusb.com and will be translated into blogthadeusbcom_

$table_prefix = ereg_replace('^(www.)', '', $_SERVER['HTTP_HOST']);

$table_prefix = ereg_replace('.', '', $table_prefix);

$table_prefix = $table_prefix . '_';

Now all that is needed are some symbolic links on each domain linking to the directory containing your wordpress files.

There is a problem though, if your existing wordpress blog has a lot of posts, they will not be migrated.

Somehow get a SQL dump of your current database, if you are running phpmyadmin that will make things much easier.

The steps are:

  1. Export database into SQL file

  2. Open SQL file in your favorite text editor

  3. Find/Replace the current table prefix with what it will be

  4. Import the edited SQL file

  5. Test your website with the altered database tables and new wp-config.php

  6. If it works, delete your old database tables

Note: Be sure to do the database stuff first before you edit the wp-config.php so there will be no downtime!* * Note: Only delete the old WordPress tables once you are sure that the site is working with the new configuration! Note: Make sure to update database settings for any plugins that may need it, such as MySpace Crossposter

If everything is working, installing wordpress on another domain is very easy. Just symbolic link the sub-folder to the directory of wordpress. When you visit your new site for the first time you will be prompted to set up wordpress for the first time! Sweet.

Note: wp-content is shared between all web sites, therefore plugins, and themes are accessible to each site.

Here are some pictures:

What the tables looked like... With the new wp-config.php file these just simply won't work!

[caption id="attachment_297" align="alignnone" width="300" caption="TheTables"][The Tables]3[/caption]

Exporting the SQL file

[caption id="attachment_295" align="alignnone" width="300" caption="ExportSQL"][Export SQL]5[/caption]

Importing the new SQL file - Notice the new table names on the left side of the image.

[caption id="attachment_296" align="alignnone" width="300" caption="ImportSQL"][Import SQL]7[/caption]

credits: http://me.mywebsight.ws/2006/08/11/host-multiple-wp-sites-on-one-installation/

content/uploads/2008/12/table_list1-300x198.png (Zeh Tables)

installation/