How to Turn Your Existing WordPress Installation into a Subfolder Multisite

Follow the procedure below to make a subfolder-based WordPress multi-site. It’s quite easy if you’re setting up a new multi-site. If, however, you want to turn an already running WordPress site into a subfolder multi-site, you will have difficulty in Step (3) Network setup. I’ll show you how to solve the problem.

The reason why I prefer use of subfolders over subdomains or a plugin to make a multilingual site is written in this article.

  • (1) Modify wp-config.php
  • (2) Deactivate all plug-ins
  • (3) Network setup
  • (4) Enable the network
  • (5) Re-login
  • (6) Create a subfolder site

 

  • (1) Modify wp-config.php

If you’re not a geek, this specific file name might scare you off. But wp-config.php is just a text file. You just need to add specific text using a text editor.

If you don’t have an FTP application such as FileZilla, I’d recommend you to download it (Mac/Windows) now because it comes very handy when running a WordPress site.

The usage is simple just choose File -> Site Manger -> New Site and fill the fields with the host address, user name and password you received from your hosting service. It is typically written in the first email you received from your hosting company.

After establishing an FTP connection, download the entire website to your computer. The target file wp-config.php is located in the public_html folder.

Add the code below to the wp-config.php file. Don’t use MS Word or Google Office. Edit it with a simple text editor such as NotePad++ (Windows) or TextEdit (Mac). If you use NotePad++, be sure to save the file in UTF-8 without BOM encoding option.

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

Add it right above the following code.

/* That's all, stop editing! Happy blogging. */

Which means, it will be like this.

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );
/* That's all, stop editing! Happy blogging. */

Upload the modified wp-config.php file in FileZilla. The operation is very simple. You just drag-and-drop the file from your computer (left) to your website (right).

If you don’t want to use any FTP application, you can use the WordPress plugin called “WP Config Editor” to edit the wp-config.php file.

 

  • (2) Deactivate all plugins

Select Plugins from the left menu, check off the box next to Plugin, click on Bulk Actions, select Deactivate from the list, and then, click Apply.

 

  • (3) Network setup

Refresh the admin screen to renew the menu items. Select Network Setup under Tools. If you’re setting up a new WordPress multisite, you see two options Subdomains and Subfolders.

However, if your WordPress installation is old and has already been running for a while, only the Subdomains option appears at this point.

It seems impossible to turn an existing WordPress installation into a subfolder multisite. I read many articles related to this issue and they all stated you need to newly install a WordPress to chose the Subfolders option.

When I was about to give up the Subfolders option, I found the solution. It turned out to be simple. Go Appearance -> Theme Editor -> Theme Functions to edit the functions.php file, and then add the following code at the end.

add_filter( 'allow_subdirectory_install',
	create_function( '', 'return true;' )
	);

This will let you choose the Subfolders option for your old WordPress installation.

Select Tools -> Network setup -> Subfolders, and click the Install button.

 

  • (4) Enable the network

Then the WordPress shows configuration lines that you need to manually add to the wp-config.php and .htaccess files.

Copy the following code and add it to wp-config.php, The wp-config.php file is the one you edited in Step (1). You can do it either by directly editing the wp-config.php. file in a text editor and uploading it via FTP or using the WP Config Editor plugin.

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'sw-test.work');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Also edit the .htaccess file in the same manner. the .htaccess file is located in the public_html folder where the wp-config.php is also stored.

There is also a plugin called WP HTaccess Editor that lets you edit the.htaccess file on the Admin screen. If you don’t want to use an FTP application, you can use this plugin instead to add the following code to the file.

 RewriteEngine On
 # https§À≈˝∞Ï
 RewriteCond %{HTTPS} off
 RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
 
 #added for multi site

 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [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).*) $2 [L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
 RewriteRule . index.php [L] 

 

  • (5) Re-login

You will be logged out when they’re modified. Log in to the WP administration dashboard again.

 

  • (6) Create a subfolder site

Click My Sites shown at the upper left of the admin screen and choose Network Admin -> Sites -> Add New.

Specify Site Address (URL) , Site Title, Site Language and Admin Email, and click Add Site.

That way, I created “yugakurita.com/ja” and all Japanese posts are relocated under that subfolder and now yugakurita.com only shows English information. You can use the same email address as the parent site.

Additional Notes

Note that, to add a new theme to the created subfolder site, you need to go to My Sites -> Network Admin -> Theme, instead of Appearance in the left menu.

Some other menu items also moves to My Sites. For example, we now have to go to My Sites -> Network Admin -> Theme -> Theme Editor to edit the function.php file.

If you cannot locate any menu item that used to be available in the left menu, check out the menu items under My Sites.