• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Featured
    • C# Tutorials
      • LinQ Tutorials
      • Facebook C# API Tutorials
    • PHP Tutorials
      • CodeIgniter Tutorials
    • Amazon AWS Tutorials
  • Categories
    • Programming
    • Development
    • Database
    • Web Server
    • Source Control
    • Management
    • Project
  • About
  • Write
  • Contact

CodeSamplez.com

Programming, Web development, Cloud Technologies

You are here: Home / Development / Wordpress Multisite With Root Domains

WordPress Multisite With Root Domains

June 6, 2013 by Rana Ahsan Leave a Comment

wordpress multi-site

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 🙂

Share If Liked

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pocket (Opens in new window)

You may also like

Filed Under: Development Tagged With: mysql, php, wordpress

About Rana Ahsan

Rana is a passionate software engineer/Technology Enthusiast.
Github: ranacseruet

Reader Interactions

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,774 other subscribers

Follow Us

  • Twitter
  • Facebook

Top Posts & Pages

  • How To Work With JSON In Node.js / JavaScript
    How To Work With JSON In Node.js / JavaScript
  • PHP HTML5 Video Streaming Tutorial
    PHP HTML5 Video Streaming Tutorial
  • How To Work With C# Serial Port Communication
    How To Work With C# Serial Port Communication
  • Facebook C# API Tutorials
    Facebook C# API Tutorials
  • Using Supervisord Web Interface And Plugin
    Using Supervisord Web Interface And Plugin
  • LinQ Query With Like Operator
    LinQ Query With Like Operator
  • Get Facebook C# Api Access Token
    Get Facebook C# Api Access Token
  • Getting Started With UDP Programming in Java
    Getting Started With UDP Programming in Java
  • Utilizing Config File In C#.NET Application
    Utilizing Config File In C#.NET Application
  • Generate HTTP Requests using c#
    Generate HTTP Requests using c#

Recent Posts

  • Building Auth With JWT – Part 2
  • Building Auth With JWT – Part 1
  • Document Your REST API Like A Pro
  • Understanding Golang Error Handling
  • Web Application Case Studies You Must Read

Tags

.net angularjs apache api audio auth authenticatin aws c# cloud server codeigniter deployment docker doctrine facebook git github golang htaccess html5 http javascript jwt linq mysql nodejs oop performance php phpmyadmin plugin process python regular expression scalability server smarty socket.io tfs tips unit-test utility web application wordpress wpf

Footer

Archives

Follow Us

  • Twitter
  • Facebook

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,774 other subscribers

Copyright © 2023