WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] images files broken (18 posts)

  1. sozomai2
    Member
    Posted 6 months ago #

    I know there are a number of topics already about this problem. I have scoured them all and nothing that is suggested on any of them has helped fix my problem.

    I recently attempted to update by wordpress multisite installation to the newest version of wordpress ( 3.8.1 ) when I did that the whole site brokedown. I had 20 blogs on the site and none of them showed up anymore. I ended up creating a new database and going through the install program for a new copy of wordpress. Once my new site was working I imported all the database tables for all the children sites into the new database. Everything is working fine now except the images are all broken on all the sites.

    My .htaccess code is below and I already checked the AllowOverride All setting is correct as well

    # 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
  2. What do you mean by 'broken'?

    What version of WP did you originally install as Multisite?

  3. sozomai2
    Member
    Posted 6 months ago #

    I'm mean they don't show up on the website. The link isn't working.

    I don't remember which version of wordpress I originally used it was something like six years ago.

    As a temporary measure I created the following .htaccess rule for each website:
    RewriteCond %{HTTP_HOST} ^website\.org [NC]
    RewriteRule ^files/(.+) wp-content/blogs.dir/1/files/$1 [L]

    with these rules in place the images show up fine but obviously I would rather not use this in the long term.

    Thanks

  4. See http://codex.wordpress.org/htaccess#Multisite - That's why I was trying to suss out what version of WP you used to install Multisite (if it really was 6 years ago, you were using WPMU which ... yikes).

    If you're redirecting files, then this is the issue:

    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    When you go to domain.com/files/2014/02/image.jpg what do you see?

    What do you see at domain.com/wp-includes/ms-files.php?file=/2014/02/image.jpg ?

  5. sozomai2
    Member
    Posted 6 months ago #

    Yes I definitely started with WPMU

    I did read that file that you referenced, and prior to the newest upgrade the .htaccess code they list on that page has been working fine. Previously I was using the one listed under "WordPress 3.4 and below" -> "subdomain example".
    Just now I tried the one listed under WordPress MU even though it is for a subfolder install and I have always used a subdomain install. Needless to say it didn't work.

    I tried manually writing in the ms-files.php file as you suggested above and it returns only a 404 file not found message.
    eg. http://domain.com/wp-includes/ms-files.php?file=/2009/08/cross-293x300.png

    I did check and confirm that the image was there. If I go to the link:
    http://domain.com/wp-content/blogs.dir/1/files/2009/08/cross-293x300.png
    the image shows up fine

    The only conclusion I can draw is that the ms-files.php isn't working correctly. My assumption would be that the ms-files.php file is at some point looking for a setting or an option and is not getting it or is not getting the right one.

    Looking at the code in the file it seems this "BLOGUPLOADDIR" is the important constant. In fact if I define this constant manually in my wp-config.php file it works however obviously only for one blog.

    Following the chain it looks like this constant is defined in ms-default-constants.php. In this file I see that if get_site_option( 'ms_files_rewriting' ) returns false "BLOGUPLOADDIR" is not defined. If I temporarily comment out these two lines in this file the images show up.

    So this would indicate that the ms_files_rewriting option is not set correctly. Which table does get_site_option look up? wp_options? I can not find any such option in this table, but then that might be the problem. Or am I missing something else?

  6. You can define BLOGUPLOADDIR directly per site.

    When you're at /wp-admin/network/sites.php you can hover over the site and click on 'edit'

    Go to the Settings tab and look for these -- DO NOT EDIT THEM JUST YET:

    Upload Path
    Upload Url Path
    Fileupload Url

    What are they for one of the broken sites?

  7. sozomai2
    Member
    Posted 5 months ago #

    here are two examples

    main blog
    upload path: wp-content/blogs.dir/1/files
    upload url path:
    fileupload url:http://domain.org/files

    blog 4
    upload path: wp-content/blogs.dir/4/files
    upload url path:
    fileupload url:http://blog4.domain.org/files

    As far as I can see they are all like that

  8. Hmm. Do you have Fileupload Realpath ?

    Those are all correct.

  9. sozomai2
    Member
    Posted 5 months ago #

    There is no "Fileupload Realpath" setting

  10. What version of WP were you using when you originally activated Multisite?

  11. Web Guru
    Member
    Posted 5 months ago #

    what's your current version of wordpress ?

  12. 3.8.1, according to the first post.

  13. sozomai2
    Member
    Posted 5 months ago #

    I really couldn't tell you what the original version number was. It was years ago probably November or December of 2008. That would be my best guess as too when but I couldn't tell you the version number.

  14. So ... was this WPMU before it was merged with WP core?

  15. djlivi
    Member
    Posted 5 months ago #

    For what it is worth, I seem to have an identical problem with broken image links (working .htaccess, WPMS install that used to work but now with broken image links except when editing the image itself)

    Also on 3.8.1, and also started on WPMU (unknown version number)
    I've followed this thread carefully, and path settings, etc are all as described by Sozomai

  16. *blarg*

    There was no change from 3.5 (yes, 5) to 3.8, with regards to how images were handled.

    I ended up creating a new database and going through the install program for a new copy of wordpress. Once my new site was working I imported all the database tables for all the children sites into the new database. Everything is working fine now except the images are all broken on all the sites.

    Re-reading that makes me think your best bet would be to get rid of using ms-files entirely. http://halfelf.org/2012/dumping-ms-files/ is how I did it, and I THINK the mix of old tables and new is why this is all messed up :/

  17. sozomai2
    Member
    Posted 5 months ago #

    Finally got it working.
    I just needed to set ms_files_rewriting in the wp_sitemeta table of my database to 1. I thought I had checked this before but I was probably looking in the wp_options table instead of the wp_sitemeta table.

    Anyway its working now, thanks for all your help.

  18. djlivi
    Member
    Posted 5 months ago #

    Sadly not for me, though almost all of the problem description matches my problem - looking at my wp_sitemeta table, there is no entry for ms_files_rewriting at all - adding it with a value of 1 doesn't seem to improve things either. When I get the energy I'll start a new thread ;-)

Reply

You must log in to post.

About this Topic