• Resolved agreda

    (@agreda)


    I’ve been troubleshooting some odd behavior on a couple of our multisite installs for some time now, and have been searching these forums but can’t seem to find a fix. Thanks in advance for any feedback!

    At some point during recent WordPress updates, certain images are no longer displaying on our main site at http://tripawds.com and our dev install at http://tripawds.net

    1. Images exist but don’t display
    For years I have used a folder to host some image files I have hard-coded into various templates for different reasons.

    I have confirmed the images exist at /blogs.dir/1/files/adpix/ but they do not display in posts or pages and throw a 404 if called directly.

    2. Old Media Library Photos Do Not Show
    Many older photos in our WP Media Library do not display anymore. Here is an example file location:
    http://www.tripawds.com/wp-content/blogs.dir/1/files/friends_family/20080518w_eurekaphoto02.jpg

    You will notice this results in Page Not Found, but I have confirmed the file does exist at that URL.

    3. Certain Admin Pages Throw 404
    I’m not sure if this is related or not, but on our dev install I am not able to access themes.php on certain sites.

    Now… I did find support topics suggesting this may likely be caused by our httpd.conf setup, so I have confirmed that AllowOverride is set to all:

    <Directory "/">
        Options ExecCGI FollowSymLinks Includes IncludesNOEXEC Indexes SymLinksIfOwnerMatch
        AllowOverride All
    </Directory>

    I also thought something may be awry with our .htaccess file, so I’m including that for review too:

    RewriteEngine On
    RewriteBase /
    
    # uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]
    RewriteRule ^(.*/)?sitemap.xml wp-content/sitemap.php [L]
    RewriteRule ^(.*/)?global-posts-feed/(.*) wp-content/recent-global-posts-feed.php [L]
    RewriteRule ^(.*/)?global-comments-feed/(.*) wp-content/recent-global-comments-feed.php [R=301,L]
    
    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    Thanks again for any suggestions.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Issue 1:

    I believe you are trying to access with www. http://tripawds.com/wp-content/blogs.dir/1/files/adpix/icon-twitter.png is returning 200 OK response.

    Issue 2:

    Again, it’s the www causing issues. http://tripawds.com/wp-content/blogs.dir/1/files/friends_family/20080518w_eurekaphoto02.jpg responds as expected.

    You might consider searching the database and replacing all instances of http://www.tripawds.com/* to http://tripawds.com/* using a tool such as https://interconnectit.com/products/search-and-replace-for-wordpress-databases/. However, for all your pages I would suggest making the www-version redirect to non-www version because some of your users may be in the habit of typing www. You can do this via .htaccess.

    In regards to #3, I’m not sure. Have you tried the normal troubleshooting procedure of disabling all plugins, using default themes, etc?

    Thread Starter agreda

    (@agreda)

    Thank you for the quick reply Patrick!

    I’ve taken your advice and implemented a non-www redirect via .htaccess.

    And, after doing the following search and replace, the legacy images in question appear to be displaying properly on the front end:

    UPDATE wp_1_posts SET post_content = REPLACE ( post_content, 'http://www.tripawds.com/', 'http://tripawds.com/')

    One issue remains. The old photos within the Media Library still just show the default preview image. Editing the media, indicates that the image file URLs still include www/. For example: …www.tripawds.com/wp-content/blogs.dir/1/…

    This results in the images not displaying on the attachment pages, which is no big deal. But I would like to have their thumbnails back in the Library to make searching for old photos easier. (The reason I discovered this issue in the first place.)

    Upon further investigation, all images uploaded to the Media Library after 2009/07/20± do have a preview image and no www in the file URL.

    So… assuming it would fix this, what table(s) and field(s) would I search to replace the image file URLs in the Media Library? I’ve bee searching various tables, but can’t seem to find further reference to the http://www.domain/&#8230;

    Thanks again!

    PS: Regarding the third issue I brought up, I am still troubleshooting it but I’m starting to think it is unrelated since the changes above had no affect. Please disregard that for now and I’ll start a new topic if i need further assistance.

    So… assuming it would fix this, what table(s) and field(s) would I search to replace the image file URLs in the Media Library?

    The metadata associated with the uploaded images should be the file path and not the full file URL. Did you run a search through the whole database? If not check out https://interconnectit.com/products/search-and-replace-for-wordpress-databases/. Do a dry-run and find all instances of http://www.domain.com and then have the tool replace those with http://domain.com.

    You installed multisite a while back. You probably have a fileupload URL value somewhere but I don’t have a test database that dates this far back.

    Thread Starter agreda

    (@agreda)

    This is just bizarre…

    I’ve used both PHPmyadmin and the script to confirm no further references to http://www.domain.com

    I also confirmed that fileupload_url option is set to http://tripawds.com/files

    Images are now displaying properly on the front end so I suppose that is a step in the right direction.

    We are still missing preview images in the Media Library for legacy images older than a certain date. If anyone has suggestions for resolving that, I’m all ears.

    Otherwise, I think I’ll quit while I’m ahead. I’ve got bigger fish to fry…

    Thanks again for the help Patrick!

    Moderator Bet Hannon

    (@bethannon1)

    I don’t know if this is helpful or not, but I did have some issues in a multisite around upload path:
    http://wordpress.org/support/topic/upload-path-missing?replies=24

    As of WP 3.5, all new installs upload to: /wp-content/uploads/sites/#/ (except for the main site, which is still in /wp-content/uploads/).

    Before that, they uploaded to wp-content/blogs.dir/[site#]/.

    I finally worked with a developer friend to migrate away from the older system because it was causing me issues.

    Maybe this is related to your issue?

    Thread Starter agreda

    (@agreda)

    Maybe this is related to your issue?

    Definitely related…thank you.

    With this boiled down to a minor annoyance in the Media Library now, thanks to Patrick’s help, I’ll be letting it sit on a back burner for a while.

    Thanks again everybody.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Legacy Images Not Displaying and odd Redirects’ is closed to new replies.