2

I have installed Wordpress using multisite + path (as opposed to subdomain).
Seems to work, except JS/CSS files are not loaded. my conf:

<Directory "/var/www/pages">
  Options All
  AllowOverride All
  Order allow,deny
  Allow from all
</Directory>

My htaccess

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

I followed all the steps in worpress.org tutorial on how to create multisite. Here is the config file entries:

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

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'localhost');
define('PATH_CURRENT_SITE', '/pages/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

What am I missing?

2
  • 1
    not at all sure that this is the problem, but you're missing a closing double quote in that conf file...
    – Jen
    Commented Dec 31, 2012 at 19:29
  • nop, that did solve nothing. Ill edit code to show fix Commented Dec 31, 2012 at 19:42

3 Answers 3

4

The problem was in the .htaccess file the installation script generated. Specificaly, those two lines:

RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) home/itaymoav/dev/lmspages/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ home/itaymoav/dev/lmspages/$2 [L]

The path in there is the actual path to the files. While it had to be the relative path from root dir of the worpress installation. Or, to put it simply:

RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]

Funny

1

I know that is not your case, but I was facing the same problem with IIS and web.config.

I found a new web.config rewrite rules here (https://gist.github.com/misaxi/67cb1444a7dccf11f7fa) and it worked just fine.

I Hope it helps somebody.

    <rewrite>
        <rules>
            <rule name="WordPress Rule 1" stopProcessing="true">
                <match url="^index\.php$" ignoreCase="false" />
                <action type="None" />
            </rule>
            <rule name="WordPress Rule 2" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
                <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
            </rule>
            <rule name="WordPress Rule 3" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
                <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
            </rule>
            <rule name="WordPress Rule 4" stopProcessing="true">
                <match url="^" ignoreCase="false" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                </conditions>
                <action type="None" />
            </rule>
            <rule name="WordPress Rule 5" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
                <action type="Rewrite" url="{R:2}" />
            </rule>
            <rule name="WordPress Rule 6" stopProcessing="true">
                <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                <action type="Rewrite" url="{R:2}" />
            </rule>
            <rule name="WordPress Rule 7" stopProcessing="true">
                <match url="." ignoreCase="false" />
                <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
    </rewrite>
0

I had an issue with CSS and JS files not loading but for me the solution was related to Cache Manager in WHM/cPanel. There are two settings in Cache Manager that need to be disabled for multisite subfolders to work correctly. First is setting the Cache Profile to No Caching. The second is under Advanced Settings and you need to disable the Accelerate static content setting. The Accelerate static content serves static files via nginx and bypasses the Apache rewrite rule for CSS and JS files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.