WordPress.org

Ready to get started?Download WordPress

Forums

Images missing in imported posts (5 posts)

  1. John Beales
    Member
    Posted 3 years ago #

    I upgraded to 3.0 on my main blog then consolidated my standalone WP installs into the 1 3.0 multisite install, with domain mapping, (using the instructions in the codex).

    I just noticed that images are not appearing in the old posts that have been imported. The image URLs still point to wp-content/uploads/{date}/{filename}, however, this doesn't seem to map to anything in 3.0. I had hoped that those WP URLs would be updated in the import process, but apparently this hasn't happened.

    What's the best solution here - should I be adding a rule to my .htaccess that maps /wp-content/uploads to the wp-includes/ms-files.php, or is there another, less hack-ish, way to get my images to display.

  2. berchman
    Member
    Posted 3 years ago #

    I would be interested in knowing this as well.

  3. Unless you deleted the uploads folder, I think you can leave them be.

    What I did was move them to wp-content/blogs.dir/1/files/YYYY etc (blog 1 being my main blog) and then tossed this in my .htaccess:

    # Moved Images
    RewriteRule ^wp-content/uploads/(.*)$ http://domain.com/wp-content/blogs.dir/1/files/$1 [L,R=301]

    Alternately you could search/replace on your database, but I'm lazy.

    You will also need to tell Blog #1 that it now stores it's files in blogs.dir/1/files/, there are a couple places to manage that, so look through the http://domain.com/wp-admin/ms-sites.php?action=editblog&id=1 (where again, 1 is the blog number) interface.

  4. John Beales
    Member
    Posted 3 years ago #

    Oddly enough, the files have all been imported, (these are images from another blog that I did a WP export on, then imported the exported file into my 3.0 multisite blog), so they're in blogs.dir/{id} already - except on the "main" blog of the site, (id 1), since I upgraded from WP standalone, not WPMU. Its files are in wp-content/uploads I tried moving its files to blogs.dir/1 but it seems to have a database setting somewhere that tells WP that the files are in wp-content/uploads, so that didn't work too well.

    I added this to my .htaccess:
    RewriteCond %{HTTP_HOST} !johnbeales\.com [NC]
    RewriteRule ^wp-content/uploads/(.+) wp-includes/ms-files.php?file=$1 [L]

    johnbeales.com is the site with ID 1, so it gets its files from wp-content/uploads, but everything else goes to blogs.dir. So far it's working, if a bit hackish.

    I also found that since I had been using a custom thumbnail size that when the images were imported they were not imported at the correct size, so in addition to my path issues I had bad filenames. The Regenrate Thumbnails plugin solved this for me.

    I'd still like to not have to be hacking around in my .htaccess, but at least it works now.

  5. Alternately, you could manually create the 1 folder, move the files, and make the changes. I just wrote a blog post about this, after thinking about your problem: http://code.ipstenu.org/moving-your-images-for-multisite/

Topic Closed

This topic has been closed to new replies.

About this Topic