• Resolved rexgoode

    (@rexgoode)


    I run several installations and they are all having the same problem.

    Images are disappearing in subdomains after upgrading. I can’t say when it started, because I wasn’t paying attention.

    My blogs go back to days when media files were uploaded to wp-content/uploads/YYYY/MM where YYYY is the year and MM is the month.

    I just recently noticed that all of my subdomains have posts with missing images. The images are still in wp-content/uploads/… but they are not being looked for there.

    Instead, if I inspect the <img> tag, src attribute looks like:

    https://subdomain.example.com/files/myimage.jpg

    I created a wp-content/blogs.dir/n/files subdirectory, gave it all of the right ownership and permissions. It still won’t show up in the post. (n is the blog number from wp_blogs)

    I tried changing the subdirectory structure to wp-content/blogs/n/myimage.jpg and it still won’t show the picture.

    What is the mechanism that takes a URL like subdomain.example.com/files/myimage.jpg and makes it look in blogs.dir/n/files/myimage.jpg or blogs/n/files/myimage.jpg?

    Whatever it is, it isn’t working on any of my domains.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    What is the mechanism that takes a URL like subdomain.example.com/files/myimage.jpg and makes it look in blogs.dir/n/files/myimage.jpg or blogs/n/files/myimage.jpg?

    That path, with the /files/ is handled by the ms-files.php file, which is (normally) referenced to in your .htaccess.

    But… That’s only used on sites that are PRE WP 3.5. Any site installed and created AFTER (not upgraded, just created) that point are all using /wp-content/sites/N/…

    What’s in your .htaccess?

    Thread Starter rexgoode

    (@rexgoode)

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    #########RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    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).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    #########RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    #########RewriteRule ^(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Huh… Did you happen to change from a subdomain to a subfolder install at some point?

    Also do you remember what version of WP you started Multisite on?

    Thread Starter rexgoode

    (@rexgoode)

    I always went with subdomain. I did try a security plugin that modified the .htaccess and then uninstalled it because it was throwing too many errors in my phperrors log. I went to a back of .htaccess to get it back. Maybe I went to the wrong backup. What should it say?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I did try a security plugin that modified the .htaccess and then uninstalled it because it was throwing too many errors in my phperrors log. I went to a back of .htaccess to get it back. Maybe I went to the wrong backup. What should it say?

    BINGO! Try this:

    # 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
    Thread Starter rexgoode

    (@rexgoode)

    Thank you! Again!

    That works!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Images Not Loading in Network Subdomains After Upgrades’ is closed to new replies.