Support » Networking WordPress » Image handling when migrating to multisite

  • I’m currently planning on converting an existing blog (been running for over 2 years) to multisite, but am wondering the best way to go about it.

    Currently, I have WordPress installed in a directory (‘wordpress’) and all image paths reference that: e.g. xyz.com/wordpress/wp-content/uploads/….

    When moving to multisite, it seems my only option (based on http://codex.wordpress.org/Create_A_Network) is sub-domain, which requires WordPress be moved out of it’s own directory. When I do this, (I think..) any external hyperlinks pointing to my images (and by that I mean xyz.com/wordpress/wp-content/uploads/…. ) will no longer provide the proper path to the image. Or am I missing something?

    How have people dealt with this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    If you currently have your images in wp-content/uploads, then they will remain there for your main site. All subsites get magically created in the new location 🙂

    I wrote about this here: http://code.ipstenu.org/moving-your-images-for-multisite/

    When moving to multisite, it seems my only option (based on http://codex.wordpress.org/Create_A_Network) is sub-domain, which requires WordPress be moved out of it’s own directory.

    while ipstenu is correct, the above may or may not also apply.

    – you can force subfolders if you really really want to (warnings abound, just fyi)
    – you only need to move it out of its onw directory IF you have the files in a folder and are serving the URL from the rot (ie; you moved index.php). Otherwise, if it’s simply installed in a folder, you’re fine.

    Thread Starter CompressedAir

    (@compressedair)

    Thanks for the speedy replies!

    If you currently have your images in wp-content/uploads, then they will remain there for your main site. All subsites get magically created in the new location 🙂

    But when I do a subdomain install, I’m forced to move them one directory higher, e.g.: ‘/home/public_html/xyz.com/wordpress/wp-content/…’ will now change to ‘/home/public_html/xyz.com/wp-content/’ so the actual prior hyperlinks, all prefixed by ‘wordpress’ won’t be valid anymore. I guess I could add some layer of redirection, but ideally I wanted to avoid that.

    – you can force subfolders if you really really want to (warnings abound, just fyi)
    – you only need to move it out of its onw directory IF you have the files in a folder and are serving the URL from the rot (ie; you moved index.php). Otherwise, if it’s simply installed in a folder, you’re fine.

    I guess I don’t want to risk anything with subfolders. I don’t see any problem going the subdomain route other than this potential image snag… My current structure is such:
    doc root: /home/public_html/xyz.com/index.php
    wp: /home/public_html/xyz.com/wordpress/

    ‘/home/public_html/xyz.com/wordpress/wp-content/…’ will now change to ‘/home/public_html/xyz.com/wp-content/’ so the actual prior hyperlinks, all prefixed by ‘wordpress’ won’t be valid anymore. I guess I could add some layer of redirection, but ideally I wanted to avoid that.

    db search & replace 🙂

    Yeah, you do have to move your install if you want to set up the network.

    Thread Starter CompressedAir

    (@compressedair)

    db search & replace 🙂

    Right, I’m not concerned about that. More about something like Google images referencing a popular image. Now that link won’t be valid anymore… I’ll guess I’ll just need to give a 301 redirect for all those old references.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    That, at least, is easy 🙂

    # Moved Images
    RewriteRule ^wordpress/wp-content/uploads/(.*)$ http://domain.com/files/$1 [L,R=301]
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Image handling when migrating to multisite’ is closed to new replies.