Support » Networking WordPress » Images /wp-content/blogs.dir/[id]/files/image.jpg not displaying

  • On mapped domains most images display the src attribute with – 404 error (for whatever reason these images are now not showing up.)

    However, if I change the URL to:
    The image will appear. Is this something recent in 3.4.2? Am I going to have to go through and fix all these img src attributes?

    I double checked the .htaccess, below is the standard WP .htaccess I have. Note, excluded is mod_expires block of code.

    Any help would be appreciated.

    # 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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The link /wp-content/blogs.dir/3/files/2012/03/image.jpg is the file path as seen from a file system (like via FTP). After it passes through the .htaccess mod rewrite it becomes /files/2012/03/image.jpg.

    WordPress can (at least in sub folder installs) display images that are linked via the file path even on mapped domains. I have never seen this work on sub domain installs like yours when a site is mapped with a domain. I could be wrong though…

    In any case – the correct way to link images is with this syntax /files/2012/03/image.jpg.

    Yeah, subdomain installs it should work fine. For whatever reason, image paths like /wp-content/blogs.dir/3/files/2012/03/image.jpg worked fine (and for whatever reason the Media Library would display it this way).

    It seems like a recent change (maybe 3.4.2?) broke these, I originally assumed caching or .htaccess was the issue, however I started leaning towards .htaccess or a change in 3.4.2 that I’m unaware about. Hmm.. There may be a lot of effected websites that I may need to fix.

    I looked at the blogs.dir directory and found a .htaccess file that contained the following code:

    Order deny,allow
    Deny from all
    <Files ~ "^[0-9A-Za-z]+\.(jpeg|gif|png)$">
        Allow from all

    The issue is the regex. It only allows 0-9, A-Z, a-z, and does not include dashes and underscores. The appropriate .htaccess file should read as:

    Order deny,allow
    Deny from all
    <Files ~ "^[0-9a-zA-Z.\-\_]+.(jpg|jpeg|gif|png)$">
        Allow from all

    Example; if using the first .htaccess, logo-300×300.jpg would be denied but logo.jpg would work fine. However if you use the second .htaccess example, logo-300×300.jpg AND logo.jpg would work fine.

    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Plugin Review Team Rep

    There shouldn’t be any .htaccess in your blogs.dir actually, unless you added one yourself (WP doesn’t come with one)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Images /wp-content/blogs.dir/[id]/files/image.jpg not displaying’ is closed to new replies.