[wp-trac] [WordPress Trac] #23221: Multisite in subdirectory with root site address

WordPress Trac noreply at wordpress.org
Wed Jan 29 17:11:08 UTC 2014


#23221: Multisite in subdirectory with root site address
----------------------------+------------------------------
 Reporter:  grapplerulrich  |       Owner:
     Type:  defect (bug)    |      Status:  reopened
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Bootstrap/Load  |     Version:  3.5
 Severity:  normal          |  Resolution:
 Keywords:  dev-feedback    |     Focuses:  multisite
----------------------------+------------------------------

Comment (by Denis-de-Bernardy):

 For reference, besides the installer (which creates incorrect URIs on the
 initial site that then need fixing in the database), the fix seems to be
 the following with a site installed in /wp and wp content residing in
 /content:

 wp-config:


 {{{
 define('WP_ALLOW_MULTISITE',    true);

 define('MULTISITE',             true);
 define('SUBDOMAIN_INSTALL',     false);
 define('DOMAIN_CURRENT_SITE',   'www.example.com');
 define('PATH_CURRENT_SITE',     '/');
 define('SITE_ID_CURRENT_SITE',  1);
 define('BLOG_ID_CURRENT_SITE',  1);

 }}}


 .htaccess:

 {{{
 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-]+/)?(content/.*) $2 [L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) wp/$2 [L]
 RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
 RewriteRule . index.php [L]

 }}}

 content/mu-plugins/ms-fixes.php:


 {{{
 <?php
 register_theme_directory(ABSPATH . 'wp-content/themes/');

 add_filter('network_site_url', function($url, $path, $scheme) {
     return str_replace(
         '//www.example.com/wp-admin/network/',
         '//www.example.com/wp/wp-admin/network/',
         $url);
 }, 10, 3);
 }}}

 WP insists on making the original site's live in /wp/ and I'm actually
 fine with that. I'll post updates and patches in here if I find more
 issues/fixes if the ticket gets blessed by a core dev.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/23221#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list