WP multisite: same one folder structure for main site and subsite



  • Hi,

    My first post but a bit of a long one as this is fairly complicated:

    I am trying to set up MediaCloud on a WP multisite which uses the same theme across different languages, currently English and French. As the content is the same and is simply translated, plus the fact that the site has a lot of images, it seems to make sense to use the same folder and same URL for the images used on each site. All tags are automatically generated from the filename and there is 9 times out of 10 no difference between the description in French or English so overkill to create FR specific filenames. They support the content but the filenames describing the photos are identical.

    In this context, I had, with an alternative and competitive plugin the option to have a different URL for the main site and the subsite and although I thought this was good it will save me a lot of time and money (disk space, bandwitch on both server and CDN) to only use one folder and more importantly one URL structure for both sites. Not sure if I will take an initial SEO hit on the FR site if the images for that are switched to the main site.

    The site is set up with a folder (not subdomain) subsite structure. I use Cloud storage, Direct Upload, Crop and Imgx.

    Now when I tested it with the Media Cloud pro multi-site version of the plugin, it took me some time to get it to work because I had (without realising) media library issues on the production site. Once I resolved these mainly postmeta data issues in the DB, it started to get closer to what I wanted.

    However to try and achieve what I explained above I did some tests and by modifying some settings was able to achieve it but it won't be viable long term from what I can see.

    In the path setup for cloud settings I started with the recommended settings but this put the files in very different folders, notably sites/2/uploads...

    With the previous plugin I used I could have
    domain.com/wp-content/uploads/2019/10
    and for the second site (subsite) I could have:
    domain.com/fr/wp-content/uploads/2019/10
    whereas with MediaCloud and the recommended settings I can't create this structure as I can't go back up to that level and end up with:
    domain.com/wp-content/uploads/sites/2/uploads/2019/10 (which is pretty ugly)

    By using "wp-content/uploads/@{date:Y/m}" I was able to set both the main site and the subsite to put media in one and the same folder:
    domain.com/fr/wp-content/uploads/2019/10

    So I have network settings that override all other settings, ie you set them once for main site and all subsites.

    When I upload a file (file_1.jpg) from the FR site it goes into the above folder, weirdly, even though I have selected direct upload for all sites, I get the traditional WP upload interface.
    When I upload a different file (file_2.jpg) from the main EN site, which has the direct upload interface and it uploads to the main folder fine.
    Now I tried uploading the opposite files so file_2.jpg from the FR site and this works (well it was already there) and doesn't create a duplicate.
    Then I try to upload file_1.jpg from the main (EN) site it errors out in the direct upload interface.
    So I then switched the direct upload option off, get the normal WP dashboard, and when I upload the file_1.jpg it works and doesn't duplicate.

    Note: when I upload the second time and in each case I say it works, I mean I see the image, the meta data etc is fine and the file sits in the correct cloud folder (it may be overwriting but it seems to work for both sites) either way.

    Now the points about this process that I have are the following:

    1. As I'm using Imgx I don't want all the thumbnails being uploaded to the folder like they are at the moment (but because Direct upload doesn't work on the second site anyway...)
    2. As I'm using Imgx I'm not bothered about them being uploaded without being compressed
    3. As I am switching from a site that uses a CDN with the thumbnails fully generated and that these are registered with Search Engines, having these uploaded for the moment is probably not bad (ie they will be picked up until the Search Engines drop them when they see the new ones)
    4. However I would like, once the new URLs from Imgx that are generated on the fly, to not have these thumbnails generated.

    Is there a way to do this differently so that I can have that one same folder but only upload the master file for Imgix?

    I hope the above is clear enough, if not let me know 🙂

    Thanks,

    John



  • @John-Garner

    I had an idea in the shower that may fix your issue, but it'll be a week before I can implement it and roll it out. You'll be able to specify custom upload directories for each sub-site individually. Which I think covers your edge case.

    Direct Uploads are integrated with the default WordPress upload UI, you wouldn't be able to tell the difference. But I'll confirm DU is working on subsites tonight.



  • Hi there,

    Lol for the eureka moment 🙂

    I also appreciate it is an edge case so thanks very much for giving it thought and looking for a solution. That would be great.

    From an SEO perspective, do you know what the best approach is btw when you are switching from standard type URLs with thumbnails that are static to a dynamic set of URLs like the ones I will get from Imgix? I read that Google themselves recommend systems like Imgix and their competitors but I'm worried about switching in a way that does destroy all the existing of site image rankings on Google Images.

    Thanks,

    John



  • @John-Garner

    Just released 3.2.3 which includes the ability to specify different upload paths for subsites:

    Screenshot of Safari (10-17-19, 12-22-42 AM).png

    I did confirm that direct uploads are working on subsites, at least on our test systems (we have 4 different multisite test rigs). But not each server is the same, so if you are still having issues let me know.

    As for the SEO, I know absolutely nothing about SEO so I don't know that I'll be much help there.

    Thanks!

    Jon.



  • Hi Jon,

    Thanks, that looks great. I'll try and it out and get back to you if there are any issues 🙂

    John


Log in to reply