Problem with Wordpress multisite subsites admin panel css and js url

113 Views Asked by At

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]

I saw some similar questions here about this kind of problem but none provided a clear solution for my issue.

Thanks in advance to anyone that provides any help

I tried adding solutions to the htacces and config but found no solution, also applied changes to wp network/multisite options, saving permalinks modification on each subsite etc.

Currently assets are loading like this:

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

But I expect is that it should be loading like this:

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

0

There are 0 best solutions below