WordPress.org

Support

Support » Multisite » Weird image problem with sub-site images not showing

Weird image problem with sub-site images not showing

Viewing 15 replies - 1 through 15 (of 31 total)
  • Can you share what’s in your .htaccess file?

    oops. I knew I was forgetting something. My current htaccess looks like this:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !\..+$
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule (.*) http://www.the-bunker.net/$1/ [R=301,L]
    RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    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 . index.php [L]

    The added bit that wasn’t stock was to get around the other issue I was having. Link to other thread is here:
    http://wordpress.org/support/topic/anyway-to-remove-the-trailing-when-using-sub-folders?replies=6

    Thanks again

    I’m having the same problem after setting up the WP 3.0 multisite feature –everything else seems to work except the image upload (it is not shown after upload and also missing in the media list). I followed the .htaccess setting suggested after I created the network (see below). Would appreciate help from the WP forum experts in multisite configuration.
    Thank you.

    ……

    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]

    bumpity?

    Anyone have any ideas on this? I have to admit I am getting a tad frustrated 0_o

    I would really appreciate any help on this problem from those who were able to find a fix. I’m ready to fall back on the non-multisite version of WordPress 3.0 because this problem has been very frustrating. I have followed the other related forum discussion. I’ve followed the suggestion to fix via the Apache httpd configuration, but this setting broke the redirection of our subdomain sites. Thanks.

    Andrea Rennick

    @andrea_r

    Customer Care at Copyblogger Media and Studiopress

    Without some very very *specific* details about your setup.. I can only refer you to the same ol’ threads in here.

    Could I get a link to the Apache thing? I am thinking about downgrading as well…ug, the thought makes me sick (I have way to may sub sites set up already).

    Is this a known bug or a random mishap?

    Define “very very * specific*”. If it can fix the problem I will spit what I can (and find out what I can’t).

    After recently installing WordPress 3.0.1 myself, I ran into this problem with my first subdomain-based blog. I found this discussion and saw I was in the exact same boat.

    Fortunately (for me, and hopefully for others) I discovered a resolution that may help many people.

    My .htaccess file includes code that prevents people from hotlinking to images on my site. That code provides for a few exceptions (domains I control myself). Until now, I hadn’t really needed to worry about sub-domains.

    Here is an example of the .htaccess code I am now using. My images are loading fine on the subdomain. The first block of code prevents the hotlinking (while allowing major search engines and my sites to show my images).

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com(/)?.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://([^.]+\.)+example.com(/)?.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?google.com(/)?.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?bing.com(/)?.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?yahoo.com(/)?.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?bing.com(/)?.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?ask.com(/)?.*$ [NC]
    RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://www.example.com/hotlink.jpg [R,NC]

    # Enable WordPress 3.0.1 (multi-site) control over root URL
    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 3.0.1 specific code

    The section embedded in the “WordPress 3.0.1 specific code” section is the same code apyano posted a week ago. So far, this is all I seem to need in my .htaccess file to allow everything to work.

    Okay, so I posted that without explaining the fix. This is the line that allows my subdomain to use images from within WordPress:

    RewriteCond %{HTTP_REFERER} !^http://([^.]+\.)+example.com(/)?.*$ [NC]

    I probably no longer need the line above it.

    Andrea Rennick

    @andrea_r

    Customer Care at Copyblogger Media and Studiopress

    @satyr607 it’s not a bug but a well known issue people run into and have issues fixing on their servers. It’s all server setup, WP just taps into it.

    @apyano if you tried to fix the apache part and broke something else, then you put something in the wrong spot.

    sffandom – Google will snag your images anyway. They don’t hotlink, they cache, so you don’t need all that (actually, IIRC, ALL search engines cache – otherwise they’d kill us). Read this about a better .htaccess setup for hotlink prevention: http://perishablepress.com/press/2007/11/21/creating-the-ultimate-htaccess-anti-hotlinking-strategy/

    So what part of the server setup do I need to be looking at? I have tried every *fix* I can find through the search here to no avail. Ok, likely not ALL of them but this issue seems pretty random with one fix helping one person and very few else.

    After digging some more it seems that “some” of the images are pulling correctly (Header images for example) it is just the images that users are uploading.

    Is that function that handles the image links somehow using the server setup to redirect the images? Other than the .htaccess that is.

    Any help would be amazing, I have been fighting with this for almost 2 weeks now and am beyond frustrated.

    Header images are in a different location than uploaded images.

    Is that function that handles the image links somehow using the server setup to redirect the images? Other than the .htaccess that is.

    Nope, just .htaccess – which is why we’re pretty sure it’s something hinky with your server not reading that file right.

    http://the-bunker.net/wp-content/blogs.dir/6/files/2010/09/59.jpg doesn’t work, BTW…

    You’ve got subfolders, so lets rewind back to the standard .htaccess:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    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 . index.php [L]
    # END WordPress

    Take out the special stuff you added to solve the other problem JUST FOR NOW.

    Then double check the permissions on blogs.dir and make sure they’re readable 🙂

    Andrea Rennick

    @andrea_r

    Customer Care at Copyblogger Media and Studiopress

    In re-reading, the htaccess you posted previously had double instances of rewrite rules – both single wordpress ones and the multisite ones.

    When you are instructed to put in new rewrite rules, these *replace* what you have. they aren’t additions.

    I reset the .htacces to the one listed above. I also seem to have deleted the image I linked at some point. Here is a new one.

    http://the-bunker.net/satyr/files/2010/09/48.jpg

    Still the same image issue now with the same old trailing slash thing. I also noticed I am getting these errors:

    [Wed Sep 22 01:21:32 2010] [error] [client 66.249.71.18] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use ‘RewriteOptions MaxRedirects’ to increase the limit if neccessary.

    Likely relating to the same issue. I am starting to think it is the server borking up the .htaccess file.

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘Weird image problem with sub-site images not showing’ is closed to new replies.
Skip to toolbar