I've converted an existing site to multisite with subdomains. There were a few issues to sort out, but it's working well now, with one exception:

Images for the main site are uploading fine, but not for subdomains. For instance, images which should be placed in:


...are ending up in:


I suspect the error is in the #uploaded files line below, but I'm not sure what it's doing.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?siteN/files/(.+) wp-content/blogs.dir/N/files/$2 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

# Redirect to www
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


# END WordPress

When I move the files to the correct location using FTP, the images appear as they should in the media library.

  • Go to /wp-admin/network/site-settings.php?id=6 and look for the "Upload Path" setting. What's it set to? – Otto Aug 2 '16 at 17:09
  • It's /var/sites/g/mydomain.com/public_html/wp-content/uploads/sites/6 – Richard Hare Aug 2 '16 at 17:40

Check the value of the ms_files_rewriting option in the site_options table.

If ms_files_rewriting is disabled, then WordPress will automatically append /sites/number to that Upload Path value for the subsites.

This setting should be disabled by default for any Multisite networks created after WordPress 3.5. It should only be enabled for older networks.

If that setting is properly disabled, then simply remove the extra /sites/6 from your Upload Path. WordPress will add it in for you.

Basically, WordPress 3.5 changed how uploads were stored for multisites, and how those upload path options works. The setting exists to differentiate between the two different configurations. The /blogs.dir/ thing is the old way. The new way is simply to put them in /wp-content/uploads/sites/number instead, and link directly to their URLs. No more RewriteRules for files needed.

  • Perfect - thank you. Should I remove the rewrite rule from .htaccess? Will I need to edit the upload path for any sites I create in future? – Richard Hare Aug 2 '16 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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