• Resolved Rachel

    (@rleggett)


    Hi,

    I work for a university that runs a Multisite network. We have come across some strange behavior that I am thinking is a bug, but I wanted to ask and find out.

    Say we have sitex.ourdomain.com with an ID of 25 and sitey.ourdomain.com with an ID of 30. When a media file is uploaded through the Media Library on SiteX, it goes to /wp-content/uploads/sites/25/##/##/image.jpg, as expected. Linking to it with sitex.ourdomain.com/wp-content/uploads/sites/25/##/##/image.jpg loads the image properly. However, linking to it from SiteY ALSO loads the image, even though this image should only be accessible from SiteX. E.g., sitey.ourdomain.com/wp-content/uploads/sites/25/##/##/image.jpg also loads the image, even though we would expect only images in /sites/30 to load for SiteY.

    Is this the expected behavior? If so, why? I don’t believe SiteY should be able to link to a media file that was uploaded to SiteX and make the URL look like SiteY. However, that is exactly what is happening.

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • This is expected behavior. It’s the same as if a site that is not part of your network linked to the image. It’s commonly referred to as hotlinking.

    To clarify: the reason why the link works for both sub-domains is because they both point to the same file system.

    Thread Starter Rachel

    (@rleggett)

    Karpstrucking, I’m not sure you understood my question. My issue is not with linking to the image. Let me try to explain it more clearly.

    User uploads image.jpg to their site foo.site.com. Foo.site.com has site id 1. Image.jpg is now available at foo.site.com/wp-content/uploads/sites/1/15/01/image.jpg.

    Any site can link to foo.site.com/wp-content/uploads/sites/1/15/01/image.jpg and have the image appear, which is called hotlinking and is what you are saying. However, that is NOT what my question is regarding.

    Again, I have image.jpg uploaded to foo.site.com with site id 1. Say we also have bar.site.com with site id 2 on the same Multisite network. Image.jpg does NOT exist on bar.site.com. It has not been uploaded to bar.site.com and is not in bar.site.com’s images under wp-content/uploads/sites/2/. HOWEVER, take the original image link, foo.site.com/wp-content/uploads/sites/1/15/01/image.jpg, change “foo” to “bar”, and the image still loads.

    Does that make more sense? I am not talking about hotlinking.

    Thread Starter Rachel

    (@rleggett)

    I didn’t see your update before posting my reply. Are you saying that WP Multisite has no way to restrict what media files are loaded based on the current subdomain’s site ID?

    Please see the clarification to my original comment.

    Not to my knowledge, no. A direct link to an image isn’t handled by WordPress, so any control over how/when it’s displayed would need to be a function of the web server. Unless the site ID is actually part of the sub-domain, I can’t think of a way to even do it there.

    Thread Starter Rachel

    (@rleggett)

    That makes sense. Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Images appear to be available across all sites’ is closed to new replies.