Published in: PHP
This is a simple but powerful tweak to the wp-config.php file that will make it easy to run multiple websites using one database and codebase. Simply change "yourdomain.com" with your domain and that's it. Repeat that line for new domains.
// You can have multiple installations in one database if you give each a unique prefix // auto database name $domain_list["yourdomain.com"] = "";\ { $table_prefix = $domain_list[$domain_name]; } else { }
Comments
Subscribe to comments
You need to login to post a comment.

I'm confused a little bit. Should I point each domain to folder where Wordpress files are? For instance if it's /wordpress domains should be pointed to this folder? Will I be able to change template for each site (domain)?
I'm confused a little bit. Should I point each domain to folder where Wordpress files are? For instance if it's /wordpress domains should be pointed to this folder? Will I be able to change template for each site (domain)?
Yes, point each domain to the same folder. The code automatically creates a new database table prefix based on the domain name pointing to it. The first time you visit the domain, it creates the unique database entry. Then, after you run through the WordPress setup, you can choose whatever theme you want. Themes and plugins are handled by the database. So, you can have 20 themes and 20 plugins in one install, but pick and choose which ones you want to use for each individual site.
I'm assuming sub-domains can be used in the same way to accomplish what is described above? Is this correct?
What method do you recommend "pointing to" the central wordpress directory?
Assuming a server setup of: /home/domain1.com/html/ /home/domain2.com/html/ /home/domain3.com/html/ /home/wordpress/[central wordpress code base]
How would you configure the domain1.com to point to /home/wordpress/ directory?
When a file is referenced by the domain (ex. domain1.com/wp-content/themes/default/style.css), how does the server know to look for it in the central code base (/home/wordpress/) rather than under the domain directory?
Assuming a server setup of: /home/domain1.com/html/ /home/domain2.com/html/ /home/domain3.com/html/ /home/wordpress/[central wordpress code base]
How would you configure the domain1.com to point to /home/wordpress/ directory?
When a file is referenced by the domain (ex. domain1.com/wp-content/themes/default/style.css), how does the server know to look for it in the central code base (/home/wordpress/) rather than under the domain directory?
Assuming a server setup of:
/home/domain1.com/html/
/home/domain2.com/html/
/home/domain3.com/html/
/home/wordpress/[central wordpress code base]
How would you configure the domain1.com to point to /home/wordpress/ directory?
When a file is referenced by the domain (ex. domain1.com/wp-content/themes/default/style.css), how does the server know to look for it in the central code base (/home/wordpress/) rather than under the domain directory?