• Hello fellow humans.

    I have a WP multisite setup which has the some plugins installed. Im having some issues inside the admin panels of the subsites.

    For the Network and the main sub-site (i.e. /, the root URL), it works as expected. But on any non-root URL sub-site (i.e. /subsite1, /subsite2), the plugins are currently breaking because it’s trying to load the CSS & JS assets under that sub-site path. It causes the plugins to break entirely for any of the non-root subsites (i.e. infinite loading in the post/page editor, settings will not load).

    Currently assets are loading like this: 

    https://example.com/site/SUBSITE/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-global.css

    But Should be loading like this: 

    https://example.com/site/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-global.css

    I’ve done some research but it seems this problem varies for everyone and the solutions i’ve found have not worked.

    My wp-config has this

    define( 'WP_ALLOW_MULTISITE', true ); 
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    define( 'DOMAIN_CURRENT_SITE', 'mydomain' );
    define( 'PATH_CURRENT_SITE', '/site/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    And my .htacces have this

    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /site/
    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]

    Im at my wits end, Im posting in multiple forums to see if I can get some ideas to fix this

    • This topic was modified 2 years, 9 months ago by James Huff. Reason: moved to Networking WordPress since this is a multisite issue
Viewing 1 replies (of 1 total)
  • Moderator Dion Hulse

    (@dd32)

    Meta Developer

    Hi @mlaso,

    The problem looks to lie with the RewriteBase /site/ line in your .htaccess configuration.

    That line suggests that you have your Network URL setup to be example.com/site/ which you’d then have all sub-sites created as example.com/site/SUBSITE/

    That would also assume that your WP install is in /site/, ie. example.com/ is NOT this multisite install.

    Is that correct? Or have I missed something here?

    Your other option is to change the Rewrite rules such that they match the site configuration you appear to have, which would be something like this:

    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /site/
    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 ^site/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^site/([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

Viewing 1 replies (of 1 total)

The topic ‘Problem with multisite subsites admin panel css and js’ is closed to new replies.