Canonical URL for attachments


Well-known member
Up until now, each attachment was "unique", it did belog to one content only and had one URL.

With the introduction of attachment mirroring in XFMG 2.2 this will change; if an attached image does get mirrored form a post to the gallery there will be 2 public URLs (and another one that usually does never get used) for the full sized image.

Here is an example of such URL duplication:
Original Post
The attachment in this post got mirrored to this Media Item

As a result, there are now 3 different URLs that all point to the exact same image/file: (Attachment in original post) (Attachment in media item) (Media Item full image URL)

This seems bad as I think this causes duplicate content for search engines and could cause duplicate downloads for users (ify they happen to view both).

I therefore suggest to ever have only one canonical URL for an attachment, no matter how often or where it does get (re)used.

While each location where attachment does get used might have different access permissions (eg. the same user might have permission to view only one but not others), this shouldn't be a problem - as long as the user does have access permission in one location access can be granted without evading access.
Last edited:
Upvote 6


Well-known member
so... depending on what you mean... the easiest solution for xf would be:

there is a Canonical HTTP Header that can be used for non HTML pages (such as attachments)

Then the multiple urls can exist, but google will just see one.



Well-known member
That would be an option, yes. But it would only be helpful for spiders, browsers used by users would still download (and cache) multiple copies of the same content if users visit mutiple locations that share the same attachment.

Therefore I think there should be just one URL to avoid such issues/overhead.