I have a strange situation in the multisite media library.

I have a strange situation in the multisite media library. Thumbnails are not shown, and the url of the images is wrong.

The urls are showing /files/year/month/imagename, while the images are in /wp-content/uploads/sites/2/year/month

I checked the .htaccess, and there is a rule RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L] which should deal with this.

I checked with my other multisites, and they are doing fine and depicting the correct urls for the images.

The multisite on which this problem appears has had a lot of problems, due to caching. So I cleared all the caches and regenerated the permalinks, nothing worked.

Is there another setting I overlooked somehow? Please let me know. Sophie

  • aristath
    • Recruit

    Hello there @sophie_fischer,
    Please go to Settings=>Permalinks and press save. This will make sure that your permalinks are properly set-up.

    Are these images from NEW posts? Or are you somehow trying to view older posts, imported posts or something similar?

    Please advise,
    Ari.

  • sophie_fischer
    • WPMU DEV Initiate

    I already saved the permalinks several times.

    The new images are added to the /files/ directory and the thumbnails are shown. The older images are stored in the /sites/2/ directories and are not shown, because the system is looking for these images in the /files/ directory.

    In my other installations for all images, both upload and view, the directories /sites/2 (or /sites/3, /sites/4 etc) are used.

    Why is that, it seems that the rule
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    in the .htaccess file is ignored. Thanks. Sophie

  • aristath
    • Recruit

    @sophie_fischer could you please try deactivating all the plugins that you have on that network of sites? Including BP and any caching plugins that you might have enabled...
    This way we'll know if it's a plugin that's causing this or a misconfiguration of WordPress's core...

    Cheers,
    Ari.

  • sophie_fischer
    • WPMU DEV Initiate

    Hello Ari,

    I deactivated and removed all plugins. I reloaded the multi site in a test environment and now I found something ... it is really strange.

    I have done a multi site installation starting with WordPress 3.5.1. This installation should not be using the blogs.dir, as that is removed. And these lines should NOT be in the .htaccess file:

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

    But the installation is using the blogs.dir. And when I go to network settings the lines that are proposed for the .htaccess file DO INCLUDE

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

    This explains why the images are not found. The /files/ are translated to the /blogs.dir/, where there are no images, since all images are stored under the uploads/sites directories.

    Have you any idea what is happening here? Might this be a setting in one of the tables? I will continue investigating, but if you have an idea, please share it. Sophie

  • sophie_fischer
    • WPMU DEV Initiate

    Hi, I found the problem. For some reason the ms_files_rewriting flag in the wp_sitemeta table was set to true.

    I do not know why, but setting it to false (or 0) solved the problem.

    This problem can be closed, but I will continue investigating when and why this flag got a new value. Sophie

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.