Moving a WP Multisite to a subdirectory

I know it’s old but I fixed it! i installed WP MU in a subfolder.
htaccess:

RewriteEngine On
RewriteBase /YOUR_SUBFOLDER
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 ^(.*\.php)$ YOUR_SUBFOLDER/$1 [L]
RewriteRule . index.php [L]

wp-config.php:

define( 'WP_ALLOW_MULTISITE', true ); 
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'localhost'); // or your host
define('PATH_CURRENT_SITE', '');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

and in your database, modify this:

wp_site
domain: localhost (OR your domain but no subdirectory!)
path: /

wp_blogs
domain: localhost (OR your domain but no subdirectory in each blog_id!)
path: /

wp_sitemeta
siteurl: http://localhost/YOUR_SUBFOLDER (replace localhost with your host)

Leave a Comment