How to safely Change Location Upload folder and folder structure for Excisting MultiSite

I have a question for where I can't find a complete answer. The case is we have a multisite and want to change the upload location preferably to a subdomain. In this subdomain we want to have a folderstructure without separating in dates. This is because in having a Woocommerce shop we change product information regurarly and don't want images uploaded every time to a new month folder. I read that I can set the upload location in the config file, but how about changing all the existing paths to the new folder. Some did this by using WP All Migrate Plugin. As we have that this plugin in our multisite, would this mean exporting the subsites, deleting them and adding them again to the multisite. Do I change the default location for the uploads in the permalinks of the subsite to the subdomain for the uploads before exporting this or do you (WPMU support) has another (better) solution. In any case the database entries has to be rewritten to point to the correct uploads location. By the way our WP install isn't in the root but in the Public_HTML folder on our Siteground hosting.

Any help/insight in this is very appreciated,

Tom
WP Rookie

  • Predrag Dubajic
    • Support

    Hey Tom,

    Hope you're doing well today :slight_smile:

    I'm not sure that I understand your question completely so could you explain your setup a bit more please?

    By default all media files are uploaded to uploads folder, main site files will be in uploads/YEAR/MONTH/ while subsites will have this path uploads/sites/SITE_ID/YEAR/MONTH/.
    Is this also how your current setup looks like?

    Are you looking to disable YEAR folder for subsites?
    You can do that by going to your network admin, open All Sites page and for desired subsite click on Edit link, switch to Settings tab and search for "Uploads Use Yearmonth Folders" field, change the value from 1 to 0 and that will disable organizing media in Year Month folders for that subsite.

    Best regards,
    Predrag

  • Tom
    • Site Builder, Child of Zeus

    Hey Prdag,

    Yes that is correct. I want to disable year/month structure. But what about the existing images in the year/month? And how to change the default location to a subdomain? Or isn't that recommendable to change the uploads to a subdomain. I read somewhere that speedwise this is a wise thing but if this also applicable for multisite I don't know?

    Tom

  • Dimitris
    • Support Star

    Hey there Tom,

    hope you're doing good today and don't mind chiming in! :slight_smile:

    Here's an article from our blog on how to change the uploads folder through the wp-config.php file.
    https://premium.wpmudev.org/blog/change-default-wordpress-uploads-folder/

    Please take notice that previously uploaded images won't change it's location so this is something that should done manually and in order to surpass conflicts with paths, you should run a search & replace procedure in your database in order to have the correct ones. This can be done with a plugin like Better Search Replace.
    Don't skip backing-up your whole installation (files & DB) before proceeding though, as you may have to revert to a previous state. :wink:

    Also, the "Uploads Use Yearmonth Folders" option is available for each subsite of your installation, not only the main one. Go to Network admin -> Sites -> Edit (any site) -> Settings tab and search for "Uploads Use Yearmonth Folders".

    Hope that was some help,
    Dimitris :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.