WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] ms-files.php not actually serving images? (8 posts)

  1. kingkong954
    Member
    Posted 3 years ago #

    We are in the process of migrating an existing WP 3.01 multisite install with sub-domains to a new server environment.

    The issue I am having is that ms-files.php doesn't seem able to fully serve an image.

    Some scenarios:

    1) If I access the image directly, it works fine. e.g. http://domain/wp-content/blogs.dir/1/files/2010/11/image.jpg

    Here are the response headers I receive for this URL:

    Date: Sat, 20 Nov 2010 00:44:25 GMT
    Server: Apache/2.2.3 (Red Hat)
    Last-Modified: Fri, 19 Nov 2010 22:13:37 GMT
    Etag: "6bd5e-1cde0-4956f37ce0640"
    Accept-Ranges: bytes
    Content-Length: 118240
    Content-Type: image/jpeg
    
    200 OK

    2) If I try to use the URL as the WP media library has it, I get a missing image icon/result in my web browser. e.g. http://domain/files/2010/11/image.jpg

    Here are the response headers I receive for this URL:

    Date: Sat, 20 Nov 2010 00:42:24 GMT
    Server: Apache/2.2.3 (Red Hat)
    X-Powered-By: PHP/5.1.6
    Content-Length: 118240
    Last-Modified: Fri, 19 Nov 2010 22:13:37 GMT
    Etag: "1d43e654a64ff413bc8a5520d4af253a"
    Expires: Mon, 20 Jan 2014 10:29:04 GMT
    Connection: close
    Content-Type: image/jpeg
    
    200 OK
  2. Did you migrate over the .htaccess file? It's hidden so it often gets missed in a transfer.

    And this is what controls the image rewriting.

  3. kingkong954
    Member
    Posted 3 years ago #

    Hi Andrea,

    It's most definitely moved over. I tried to do some research about this, and have thrown a few hours at it already. I've seen examples of others with similar problems, but their solutions have not worked so far.

    Also normal 'pretty' permalinks work for posts and pages. It seems most also had the issue of having broken permalinks, but not me.

    Here is my .htaccess file:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    # END WordPress
  4. So you have a subdomain install?

  5. kingkong954
    Member
    Posted 3 years ago #

    Yes

  6. kingkong954
    Member
    Posted 3 years ago #

    Any ideas?

    Debugging ms-files.php, it appears it is successfully reaching the end where it actually sends the file via readfile ($file), but the browser never seems to actually receive anything.

    PHP error logs are empty, as well

  7. Are you using any caching software? Like w3tc or wpsc?

  8. kingkong954
    Member
    Posted 3 years ago #

    wow... it's fixed, and I feel like an idiot.

    I had extra return lines in wp-config.php after the final ?>

    They were somehow inserted during the transferring of files between servers.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags