WordPress Multisite With Root Domains

 WordPress Multisite With Root Domains  

This WordPress tutorial will assist you through WordPress multisite deployment. That means, you will learn to set up multiple separate root domains(as much as you want!) in a single WordPress installation and utilizing a single MySQL database. You can administer and use both sites completely separate way.

So, that you don’t get into confusion, I will like to clarify that, if you are looking for a solution to manage multiple sites under sub domains or sub folders, you should start with wordpress network creation page, that WordPress has been providing support for a while.

Why Choose WordPress Multisite?

Well there are several reasons which might convince you to have set up multiple sites on single WordPress installations. Some of the reasons are as below:

  • Maintenance: This is the most important part, why I would like to have single WordPress installation for my multiple websites. Because, it would be easier for me to maintain the plugins/themes etc for all of my sites in one place. No extra effort to update WordPress and or its plugins/themes separately for each sites.
  • Hosting Limitations: Sometimes various hosting providers doesn’t completely support setup multiple domains on separate directory on your hosting server for lower packages. In such cases, modifying your only WordPress installation to support multiple sites could be a lot handy.
  • Database Limitations: Sometime, it may be possible that you can’t afford multiple databases for costing. Utilizing single database for multiple website will help you balance your spending.

Install Your First WordPress Site:

There is no additional steps involved in installing your first WordPress site which may be required or helpful for your consecutive sites on that same installation. Just one thing to remember for a WordPress site setup. By default, database table prefix are set to “wp_”. But you should change it to something more suitable to your domain name. Like, for my site “codesamplez.com”, I would like to use “cs_” prefix very much.

Perform Second And Consecutive Installs:

Now, we are in our main stage of setup another site with our same WordPress installation. Follow the steps below carefully:

  • Setup Your Domain: First, we will need to host our new domain on same directory as our previous installation.
  • Backup Your wp-config.php and remove from server: While starting the installation, first keep a copy of your wp-config.php file and then remove it from server to let WordPress know that we want a new site installed. Be careful that, your previous domain will become unavailable also at this moment. So, consider doing it in off-pick hours where your live site get least traffic.
  • Begin Installation: now navigate to your new domain on browser and you should see the new WordPress installation page. Start your installation as you did for your first site. Just be careful about the database prefix field and give it a unique prefix which previous site doesn’t have.
    wordpress table prefix

Finally Edit wp-config.php:

if($_SERVER['HTTP_HOST'] == "www.yourfirstdomain.info" || $_SERVER['HTTP_HOST'] == "yourfirstdomain.info"){
    $table_prefix  = 'cp_';
else if($_SERVER['HTTP_HOST'] == "yourseconddomain.me" || $_SERVER['HTTP_HOST'] == "www.yourseconddomain.me"){
   $table_prefix  = 'cn_';
//and so on for all consecutive sites

So, this is it. We now should be fine now with both sites working together inside single database and single WordPress installation. Isn’t it simple? Let me know if you are facing any issue while trying the above instructions. Happy coding :)

Leave a Reply