• Resolved laurendw

    (@laurendw)


    I have WordPress multisite, set up from a basic WP install in the days when it was easy to change the default upload location, so I use images. The images in the main site show up fine, but the ones in the other sites don’t.

    The images are correctly uploaded, for example to the folder
    images/sites/3/2014/11/a.jpg for subsite #3. The generated link to the image is https://{site.com}/{subsitename}/images/sites/3/2014/11/a.jpg (I can’t show the actual site name due to customer concerns). If I take out the subsite name from the URL, then I find the image.

    It is a sub-directory site, with the .htaccess rules as specified for the post-3.5 settings. I made no changes. I suspect I need to edit the .htaccess to make the rewrite work properly, but I don’t know the best way to do that.

    Thanks for any help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Bet Hannon

    (@bethannon1)

    I am assuming that you are (eventually, if not presently) using domain mapping for the subsite, since you don’t want the mainsite to show. I’m not exactly sure how it works for subdirectories (since I use subdomains), but in my installs, while the upload urls when viewed in the Media Library have the sub-domain url:

    {subsite}.{mainsite.com}/uploads/…

    When viewed from the front of the site, where domain mapping is being applied, the urls shift to:

    {mapped-domain.com}/uploads/…

    If you are using domain mapping, have you checked to see if the mapping itself solves your problem? I’d check that first, before mucking about with .htaccess.

    Thread Starter laurendw

    (@laurendw)

    I wasn’t planning on using domain mapping. When I wrote about the site not showing I meant that I can’t point people here at at it since it’s all password-protected and you wouldn’t be able to see the problem anyway. There is live content on the main site. I’m setting up the sub-directory sites now and everything works except for the images. I’d rather avoid having to move all the images already on the main site (in the /images folder) just to enable images in the sub-directory sites.

    The domain mapping stuff looks handy though, so thanks for pointing that possibility out. I may end up using it for other sites, but it isn’t necessary for this one.

    Moderator Bet Hannon

    (@bethannon1)

    I’m not sure how to help you further. I just know that when you start messing with upload defaults, things can get messy. Hopefully someone else here has an idea for you.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    The images are correctly uploaded, for example to the folder
    images/sites/3/2014/11/a.jpg for subsite #3. The generated link to the image is https://{site.com}/{subsitename}/images/sites/3/2014/11/a.jpg (I can’t show the actual site name due to customer concerns). If I take out the subsite name from the URL, then I find the image.

    Okay, how did you change the path to include /images/ instead of being /wp-content/uploads/ ?

    Thread Starter laurendw

    (@laurendw)

    There used to be a setting to do that (pre-3.5). I installed the main site back then, without the multi-site, and added the multi-site later.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Yeah no. Multisite never had that setting easily available for a reason. ??

    Did this EVER work for Multisite? I’m betting not…

    You’re going to need to customize your .htaccess and this may be weird. Look for this line:

    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]

    below it add this:

    RewriteRule ^([_0-9a-zA-Z-]+/)?(images.*) $2 [L]

    I’m 90% sure that’s what you need here. Basically there’s nothing telling your server to redirect.

    Thread Starter laurendw

    (@laurendw)

    Thanks for posting this solution, it worked just fine!

    Sorry for the late reply, I was away a few days and only just got a chance to try it out.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘media in custom upload location has wrong URL’ is closed to new replies.