Support » Networking WordPress » Media uploads work on root site of subdir multisite, but not child sites

  • Resolved dunxd


    I setup a Network using subsites a while ago, but didn’t start using it till recently. However I did upgrade from 3.0 to 3.1.2 before trying uploads.

    Access to the sites works fine. However, uploaded media files are not appearing on child sites, although they appear in the file system. Uploaded media works fine for the root site.

    E.g. subsite:
    Uploaded a file. It appears in file system at /home/dunx/www/wp_multi/wp-content/blogs.dir/7/files/2011/05/dunxPainting-weeer.jpg. It can be accessed directly at This shows that the upload mechanism and permissions are set fine. However, WordPress expects the file to be accessed at which is returning nothing at all.

    So I suspect something is not right with the rewrite rules in .htaccess:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    These rules don’t reference blogs.dir, so I suspect they may be wrong. Can anyone put me in the right direction?

Viewing 11 replies - 1 through 11 (of 11 total)
  • this is similar to my issue faced on little while ago and still exists without a solution… better you refer my thread and grab some useful to fix your issue…. Let us update if you got something…

    check this out


    Actually, this rule DOES secretly mention blogs.dir:

    `# uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]`

    It’s part of a double redirect. It’s supposed to work like this:

    you point to

    WP translates that to

    And parses that as

    Since the second URL bombs out as a 404, however, let’s start at the basics. Is wp-includes/ms-files.php on your server?

    (ethilanka – similar, but not the same – your problem is your .htaccess isn’t being read, please don’t hijack other people’s topics.)

    wp-includes/ms-files.php exists. The 404 message is generated in ms-files.php for a few different reasons. This one looks most likely:

    ‘$file = BLOGUPLOADDIR . str_replace( ‘..’, ”, $_GET[ ‘file’ ] );
    if ( !is_file( $file ) ) {
    status_header( 404 );
    die( ‘404 — File not found.’ );

    Edited the die command to read:

    die("404 — File not found. $file" );

    And then I see what it is choking on:

    404 — File not found. /home/dunx/www/wp_multi/wp-content/blogs.dir/1/files/files/2011/05/dunxPainting-weeer.jpg

    That is completely broken. Breaking it down into what is generating $files:

    BLOGUPLOADDIR = /home/dunx/www/wp_multi/wp-content/blogs.dir/1/files/
    str_replace( ‘..’, ”, $_GET[ ‘file’ ] ) = /2011/05/dunxPainting-weeer.jpg

    Hmm – how did that extra /files/ get in there?
    Where did it get /home/dunx/www/wp_multi/wp-content/blogs.dir/1/files as a constant from?

    I installed/upgraded from svn (svn sw .)

    Go in to Network Admin -> Sites and EDIT the site this is happening on. Click on the ‘Options’ tab.

    What are the values for:
    * Upload Path
    * Fileupload Url
    * Upload Url Path

    Upload Path: wp-content/blogs.dir/7/files
    Fileupload Url:
    Upload Url Path: empty

    Well those are correct. Damn it. I can’t figure out why it would give you THIS

    404 — File not found. /home/dunx/www/wp_multi/wp-content/blogs.dir/1/files/files/2011/05/dunxPainting-weeer.jpg

    Unless you have a weird redirect plugin or line in your .htaccess.

    @ipstenu – Thanks for the assistance yesterday. I did another svn install of wordpress and this time it seems to work fine. Not worth the time to investigate further, but I really appreciate the time you gave me.

    Sure thing.

    If the new install works, then maybe it was a corrupt file? I dunno. I hate when they do that 🙁

    I don’t know if it’s correct etiquette to hijack this thread, but I have the *exact* same problem occurring on my multisite install.

    Couple of differences: I’m running WP 3.2.1, and I’m using the subdomain multisites rather than subdirectory.

    However, exact same problem occurring – a 404 on the /wp-includes/ms-files.php parsing. Has this become a known issue, or is there any understood fix/workaround for this?


    Did you try reinstalling? That worked for me, so all I can think might have happened was that a file was corrupted, and when I reinstalled, it wasn’t.

    boundforhome – Any time you have to say ‘except for…’ or the word ‘difference’ you should be making a new post since it may not be the same. (Also if the post is resolved, you should always make a new one)

    Anyway. The problem is that your install isn’t redirecting properly. The CAUSE in dunxd’s case was a corrupt file.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Media uploads work on root site of subdir multisite, but not child sites’ is closed to new replies.