The problem I have is that media (images, pdf, etc) uploaded to a the main site (id=1) in a multisite are accessible from subsites domains. Subsites are mapped to different domains.

I upload an image to the main site media library and it can be accessed at both these addresses:


www.site2.com/wp-content/uploads/imageA.jpg  -> this should not exist

even though it's not visible in site2 media library.

"Use Year month Folders" for uploads is set to 0 (inactive) in the main site settings and 1(active) in subsites settings so the file structure for media content is:

www.site1.com/wp-content/uploads/imageA.jpg   for main site

www.site2.com/wp-content/uploads/sites/2/2018/07/imageB.jpg   for site 2

Edit: this behaviour appears to be present in all the multisites I've tested.

  • Can you please make the question more readable? There is markdown functionality. Otherwise, it's difficult to read.
    – Max Yudin
    Commented Sep 19, 2018 at 18:10
  • Hi Enaki, welcome to StackExchange! Can you share your file structure so that we get a better picture of this? Commented Sep 19, 2018 at 19:20
  • Thanks. I've added markdown and file structure. Hope it's more comprehensible now.
    – Enaki
    Commented Sep 20, 2018 at 8:01

1 Answer 1


Not sure what is the problem here, and when saying that I mean that I do not see the ROI in solving it.

The core issue is that all the sites of a multisite are mapped to the same "physical" directory structure, and media files are simply served from the relevant upload directory when the url can be resolved to the file.

For your problem you probably have your virtual host files mapping both site.com and site2.com to \var\www\html and the webserver does something like map_domain_to_directory().$uri_part which will result in the same file path in both cases.

If it is important to you, you can modify the virtual host of site2 to ignore (send 404?) URLs which include only uploads instead of uploads\site\2. I would not bother as the whole point of using a multisite is to have a common admin, and if you need to have different server level handling of sites, maybe you should consider just using two different installs.

  • Thanks for the answer. The problem is that somehow some of this url are getting indexed and this could be detrimental. I've tried in other multisites and the problem appears to be present everywhere.
    – Enaki
    Commented Sep 20, 2018 at 15:39
  • yes it is present everywhere. this is a weakness in multisite which in a way is just an amplification of the weaknesses in how wordpress handles media files. There is just not going to be an easy and elegant solution for that. Maybe what you should try to do is figure out who points to those images in the wrong URL Commented Sep 20, 2018 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.