WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Weird image problem with sub-site images not showing (32 posts)

  1. Satyr607
    Member
    Posted 3 years ago #

    Got my site up and running (subfolder install) and everything is working smexy... except 0_o

    The images uploaded from the sub-sites aren't showing up at all. I have checked the server and they are uploading fine they just are not showing up on the pages correctly.

    You can see what I am talking about here...This is the post
    http://the-bunker.net/satyr/2010/09/11/squash-that-roach/

    the link that wordpress builds is to the file...
    http://the-bunker.net/satyr/files/2010/09/59.jpg
    which does not work. The file uploaded fine though and is sitting at...
    http://the-bunker.net/wp-content/blogs.dir/6/files/2010/09/59.jpg

    As you can tell the <satyr> in the link is not redirecting right even though the site itself is redirecting fine. I am guessing this is once again an .htaccess issue and again I am at a loss as to what to even be looking for.

    Any help would be AMAZING! *with bacon and sparkles*

    Thanks!

  2. dgilmour
    Member
    Posted 3 years ago #

    Can you share what's in your .htaccess file?

  3. Satyr607
    Member
    Posted 3 years ago #

    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

  4. apyano
    Member
    Posted 3 years ago #

    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]
  5. Satyr607
    Member
    Posted 3 years ago #

    bumpity?

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

  6. apyano
    Member
    Posted 3 years ago #

    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.

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

  8. Satyr607
    Member
    Posted 3 years ago #

    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).

  9. sffandom
    Member
    Posted 3 years ago #

    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.

  10. sffandom
    Member
    Posted 3 years ago #

    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.

  11. @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.

  12. 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/

  13. Satyr607
    Member
    Posted 3 years ago #

    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.

  14. 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 :)

  15. 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.

  16. Satyr607
    Member
    Posted 3 years ago #

    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.

  17. Satyr607
    Member
    Posted 3 years ago #

    Though it doesn't look like the files are uploading at all now 0_o

  18. Satyr607
    Member
    Posted 3 years ago #

    OK, new update. Grabbed the .htaccess listed on the back end of my site and the images are now uploading again. Still not showing them though. Could this by chance be a PHP version issue? I realized last night My sever still seems to be running 4.x (have put in a ticket with my host for an upgrade). I had to add the "/" bit back into the .htaccess as the site is live and it was causing my inbox to bloat. But here is what I am using now.

    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]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !example.php
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ http://the-bunker.net/$1/ [L,R=301]

    Any other thoughts?

  19. Satyr607
    Member
    Posted 3 years ago #

    UNCLE!

    I have tried everything. I have been digging through these forums for neigh 3 weeks. Trying and failing, over and over again. I do believe I have now tried everything listed here to fix this.

    This thread seems to be dieing but I have no idea at this point what info I can offer up to get this sorted. I have even had to go so far as to hard code all of the "/" re-direct's to the sub-blogs in the .htaccess.

    I was so looking forward to this option and the amazing things it could do for my site, sadly I am now pondering rolling it all back and going a different route. ANY help at all would be amazing.

  20. What host are you on? Also, that last htaccess you posted was... not right.

    Yes, you need a higher php level.

  21. Satyr607
    Member
    Posted 3 years ago #

    performancehosting.net is my host. I am in the process of getting the php on my server upgraded from 4.x to 5.2 so that should help a bit.

    What exactly is wrong with the .htaccess? other than the

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !example.php
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ http://the-bunker.net/$1/ [L,R=301]

    at the end it is what is listed in the network tab in the admin area of my site.

    I realized last night that the added chunk of code was not in the right place to begin with and adding the trailing slash this way was breaking all of the themes on the sub-sites. I have opted to use the

    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    function to add the trailing slash to each of the blogs.

  22. I meant the stuff at the end. you shouldn't need to add anything extra.

    And what plugins are you running? Any that would interfere with this at all? Be good to disable them all and check.

  23. Satyr607
    Member
    Posted 3 years ago #

    Yeah, I am thinking that the "/" issue that I was trying to fix with that might very well be tied to the image issue. *crosses fingers* In hopes that the PHP upgrade will sort them both out.

    I tried disabling all of my addons as well as going back to the stock theme with no luck. I was hoping it was a screwy addon.

  24. Satyr607
    Member
    Posted 3 years ago #

    Server upgraded to PHP 5.2.10

    Still no luck. Next?

  25. What kind of php are you running? Suphp or ... ? There are different installs :) what kind of server are you on, too?

  26. Satyr607
    Member
    Posted 3 years ago #

    Linux Server, Apache 2.2.11, MySQL 4.1.12.

    As far as the PHP goes I am not exactly sure. Its stamped with the "Zend Engine 2". This might help

    http://the-bunker.net/php.php

  27. ibdabo
    Member
    Posted 3 years ago #

    Hi all. I am having this same problem. Old photos on my site before I upgraded are working fine. But since upgrading to 3.0 no images display. I thought it was the theme i chose. but i have switched to more than 2 other themes and image is still not showing when I upload. Is this a .htaccess problem? any help will be greatly appreciated. Many thanks.

  28. Umbrovskis.com
    Member
    Posted 3 years ago #

    Did someone found solution, because putting
    rewrite rules inf front cause error 500
    and after doesn't take any efect

    Here is my old code for single blog

    <IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /blog/
    RewriteRule ^(.*)par-brivu/(.*) $1w.php?src=par-brivu/$2
    </IfModule>

    /par-brivu/ is image directory inside /blog/
    and w.php is taking care of hotlinking issue.

    for MS I understand there should be something line this
    ^([_0-9a-zA-Z-]+/)?files/(.*) for virtual folders
    or
    ^/wp-content/blogs.dir/([1-999999999])/files/(.*)
    for real path

  29. Disable the hotlinking stuff. that will interfere.
    For multisite, the Create a Network page in your admin area, gives you the htaccess rules to replace the ones you have.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.