CodeSamplez.com

Programming, Web development, Cloud Technologies

  • Facebook
  • Google+
  • RSS
  • Twitter
  • 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
Home Development Wordpress Multisite With Root Domains

WordPress Multisite With Root Domains

Rana Ahsan June 6, 2013 Leave a Comment


 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 🙂

Related

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

About Rana Ahsan

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

Leave a Reply Cancel reply

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

Email Subscription

Never miss any programming tutorial again.

Popular Tutorials

  • PHP HTML5 Video Streaming Tutorial
  • How To Work With JSON In Node.js / JavaScript
  • Generate HTTP Requests using c#
  • How To Work With C# Serial Port Communication
  • Facebook C# API Tutorials
  • How To Work With CodeIgniter Pagination
  • LinQ To SQL Database Update Operations In C#
  • Get Facebook C# Api Access Token
  • How To Work With Multithreaded Programming In C#.NET Application
  • Getting Started With HTML5 Web Speech API

Recent Tutorials

  • Building Auth With JWT – Part 1
  • Document Your REST API Like A Pro
  • Understanding Golang Error Handling
  • Web Application Case Studies You Must Read
  • Getting Started With Golang Unit Testing
  • Getting Started With Big Data Analytics Pipeline
  • NodeJS Tips And Tricks For Beginners
  • Apple Push Notification Backend In NodeJS
  • Web Based Universal Language Translator, Voice/Text Messaging App
  • How To Dockerize A Multi-Container App From Scratch

Recent Comments

  • intolap on PHP HTML5 Video Streaming Tutorial
  • manishpanchal on PHP HTML5 Video Streaming Tutorial
  • Rana Ghosh on PHP HTML5 Video Streaming Tutorial
  • ld13 on Pipe Email To PHP And Parse Content
  • Daniel on PHP HTML5 Video Streaming Tutorial

Archives

Resources

  • CodeSamplez.com Demo

Tags

.net apache api audio aws c# cache cloud server codeigniter deployment doctrine facebook git github golang htaccess html5 http image java javascript linq mysql nodejs oop performance php phpmyadmin plugin process python regular expression scalability server smarty ssh tfs thread tips ubuntu unit-test utility web application wordpress wpf

Copyright © 2010 - 2021 · CodeSamplez.com ·

Copyright © 2021 · Streamline Pro Theme on Genesis Framework · WordPress · Log in