Convert WordPress Single Site to a Multisite

N
Netooze
September 8, 2022
Convert WordPress Single Site to a Multisite

Since WordPress 3.0, users have had the option of converting their blogs into a Multi-Site WordPress installation a WordPress version that allows you to run multiple sites from a single WordPress installation and WordPress dashboard using one set of themes and plugins. You have complete control over the main site and subsites, including features, themes, user roles, security, performance and so on...

It's not something that most blog owners require, and it's not for the faint of heart either! and tends to suit more experienced WordPress users. It is, however, something that can be extremely beneficial for websites that want to divide their content into distinct channels whether using subfolders or subdomains.

However, before you jump right in and convert your blog to a multi-site installation, you should think about why you want to do so first and foremost. It will require some technical know-how to set up, and maintenance will be more involved than with a regular single blog.

But if it's something you really want to do after considering the pros and cons, let's talk about the steps.

Why Someone May Want to Use WordPress Multi-Site?

When you need to build a network of related sites, deciding whether to use multiple single-site WordPress installations or a WordPress Multisite installation is not a simple decision. In fact, there are numerous factors to consider. As previously stated, there are more than several reasons why you would want to convert your website from a single blog to a multi-site website.

Code that is more efficient

Running multiple sites on the same network means writing less code. There is only one set of core WordPress files and one copy of each theme and plugin, regardless of how many sites they are activated on. This means that your network uses less server space than if each site had its own WordPress installation. This increases as you add more sites. It can help you save money on hosting and time by keeping your code up to date.

Management that is more efficient

Updating your WordPress Multisite network is far more efficient than updating multiple WordPress installations. It's a great way to allow your company's teams and/or employees to have their own blogs while still keeping them under the same roof so to speak.  It also has the advantage of being centrally controlled by a WordPress Super Admin user and allowing you to share themes and plugins across multiple blogs. One of the pitfalls with having multiple WordPress installations as opposed to one WordPress multisite installation is maintenance and the risk that an employee directly changing code within a theme break the main site. It is much less risky to give them access to a subsite and then limit access to plugins and themes. In any event, it would be much harder for them to break anything.

Complete unique websites under one roof

The benefit of using multi-site is that each site you create can be completely unique without the hassle of installing WordPress multiple times or adding multiple databases. In a nutshell, this is the main selling point....

Configure Multi-Site

Setting up multiple sites can be difficult, but it is simple if you know what you're doing (which is why you're reading this!). It requires the addition of various pieces of code in your wp-config.php file and your web server’s .htaccess file.

The WordPress Codex contains a comprehensive guide to building a network version of WordPress.

Because you are converting an existing website, you must use the multi-site subdomain option. This is due to permalink issues that already exist within the main website. The WordPress team is looking into alternatives, but for the time being, your multi-site blogs will have URL structures of blog1.mydomain.com, blog2.mydomain.com and blog3.mydomain.com etc.

Before proceeding, make a complete backup of your WordPress installation. You want a backup of the database and files in case something goes horribly wrong and you need to roll back to the start. In any case, I know many people convert their single WordPress site to a WordPress multisite and then immediately convert it back to a single site. So you'll want to have that option.

It's time to get started now that you have a backup...

The first thing you need to do is download a copy of your wp-config.php and .htaccess file to your computer using an FTP program such as FileZilla a free and open-source, cross-platform FTP application, consisting of FileZilla Client and FileZilla Server.

One of the most important files in your WordPress installation is the wp-config.php file. This file is located in the root of your WordPress file directory. Additionally, .htaccess files (or "distributed configuration files") provide a way to make configuration changes on a per-directory basis."Be very careful when editing them.

ftp

Once you've saved them both locally, open them in your preferred text editor. Filezilla actually provides a way to do this within their interface. Because the .htaccess file may be hidden, you must configure your viewing options to include hidden files. You can find instructions on how to do this in your operating system's help file or by conducting a quick Google search.

 

htaccess

Now we need to edit the local wp-config.php file. Add the following code snippet above the first line that begins with require or includes:

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );

Once you have made the change above, upload the wp-config.php back onto your web server, overwriting the previous version. Log into your website's Admin Dashboard once the file has been uploaded. Before you can proceed, you must deactivate all of the plugins you have installed. Once the multi-site conversion is complete, they can then be reactivated.

After you have disabled the plugins browse to Tools > Network Setup.

In this section, you choose your Network Name and the Network Admin email address. Click Install when you have made those decisions.

network-create

You are then given code specific to your site to insert into the wp-config.php and .htaccess files. Please follow the steps to add this code to the local versions of the files before uploading them to your web server and overwriting the existing files which you should already have a backup of.

tools-network-created
Please note that the code required for the wp-config.php must be placed before the first line that begins with require or includes just as it was with the previous code addition.

Once you've completed these steps, you will need to log back into the Admin Dashboard. Additionally, it may be necessary to clear your browser cache for this to work correctly. This is now the Network Dashboard and once you’ve logged back in there should be a new item in the menu bar along the top of the screen. Where the name of your site was before should now display as My Sites.

network-admin-link

Here you can reactivate all your plugins as network-activated plugins and installed themes as network-enabled themes. That means they will be available for use with every site you create in this multi-site installation. This is also where you will add new plugins and themes in future so that you can then use them on every site if you choose to.

Creating A New Site

Add New Site

Now that you have configured the multi-site installation of WordPress you can now add new sites to the network. This is done in the Network Dashboard by clicking on Sites > Add New.

You then simply give the site a name and title and add the admin user email address. If this address isn’t already associated with a user, a new user is created.

Because this is a multi-site conversion with subdomain options, you must add the subdomain entry that corresponds to your new site name to your site DNS. Things will be much easier for you if you can add this a few days ahead of time. If you haven't already added this to your DNS, you should do so now and wait 48 hours before proceeding.

After the DNS has been updated, you can log into the new site dashboard and start creating content and managing the site plugins and themes as you would with any new WordPress installation. You are not required to use all of the plugins or the same theme as the main site.

You can repeat the above steps to add as many new sites as you want. Woola.

Converting an existing website into a multi-site installation has a few more issues than a clean installation, but it is a great way to add additional content channels to your domain with fewer maintenance issues.

The only real issue with converting an existing website is the requirement to use sub-domains for your sites. One of the most common problems that most web developers face when attempting to enable WordPress Multi Site is WordPress's insistence that subdirectory blogs cannot be configured. WordPress's message to demonstrate its dominance over afflicted web developers is: Because your installation is not new, the sites in your WordPress network must use sub-domains. The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.

If you prefer to have your websites as folders at the end of your domain, you might be better off starting a new WordPress multi-site installation and importing your existing website. That's the safest approach. But is very time-consuming of course.

However, if you are determined that you would like subfolders. A workaround is available for enforced subdomain addon site installations. Yes, we have the ability to fight back and force WordPress to allow subdirectory sites.

During the activation of Multi Site a few lines of code need to be added to wp-confg.php. One of those lines states:

define( 'SUBDOMAIN_INSTALL', true );

That line tells WordPress to use subdomain addon sites.

Change it to

define( 'SUBDOMAIN_INSTALL', false );

and you will now be able to create subdirectory sites.

This procedure necessitates a separate post, which we may address at a later time.

THERE ARE TWO PROBLEMS WITH ALL OF THIS.
The cost of forcing WordPress to allow subdirectory addon sites on old WordPress installations is:

  1. Subdirectory sites that have names that are similar to existing post, page, tag, category, or directory names must not be created.
  2. Some subdirectory sites will not display properly due to permalink URL structure conflicts with the main site.

The solution to the first problem is straightforward:

  1. Do not name addon sites the same as existing WordPress slugs.

The second issue is defined by any of

  • Subdirectory sites do not display when viewed
  • Subdirectory sites display but their themes are corrupt (missing CSS files)
  • Subdirectory site backend admin panels redirect to the main site’s admin panel

Other symptoms are likely as well.

The solution is simple: change the URL rewrite rules in Multi-Site.

Replace the text in your.htaccess file.

Edit your .htaccess file and replace

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]

# END WordPress

With

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress

That's all there is to forcing WordPress to allow addon site installations in subdirectories when Multi Site is enabled.

WordPress will insist on inserting a blog slug into sub-directory URLs, so my-blog.tld/site-one/my-post becomes my-blog.tld/blog/site-one/my-post. This can be removed using the Remove Blog Slug plugin, which can be found here.

Summary

WordPress Multisite is an extremely useful tool. It can save disk space and make you more efficient if you're creating multiple sites for yourself, a community, or clients.

WordPress Multisite can be used for a variety of purposes, including personal sites, client or community sites, business sites, and running a WordPress.com-like system of blogs that users create themselves. Investing time in learning Multisite will likely yield significant benefits in the long run.

Save time, and money, and improve site performance by using Netooze:

  • With 4 data centres worldwide, you can reach a global audience.
  • Our built-in Server Performance Monitoring allows for optimization.
  • All of this and more is available in a single plan with no long-term contracts and assisted migrations

We are techies passionate about WordPress. With Netooze, Managed WordPress Hosting, we want to minimize the friction that every professional faces when working and hosting WordPress projects. Get in touch at sales@netooze.com

 

WordPress Glossary Terms for Beginners

http://community.netooze.com/knowledgebase/topics/150400-wordpress

 

Netooze® is a cloud platform, offering services from data centers globally. When developers can use the straightforward, economical cloud that they love, businesses expand more quickly. With predictable pricing, thorough documentation, and scalability to support business growth at any stage, Netooze® has the cloud computing services you need. Startups, enterprises, and government agencies can use Netooze® to lower costs, become more agile, and innovate faster.

Related Posts

%d bloggers like this: