What the heck are WordPress Attachment URLs – and what to do about them?
- Last updated:
- 4 Comments
A friend of mine recently asked me what WordPress Attachment URLs are? During my explanation, it occurred to me that they’re one of those things about WordPress that frequently gets almost entirely overlooked — often at the SEO-expense of users who nine-times-out-of-ten haven’t even heard of Attachment URLs before: let alone know how to go about dealing with them! So here goes…
What are Attachment URLs:
In short: every time you insert some media (an image for example) into a post, WordPress creates an entirely new web page/post containing nothing more than that single piece of media (plus the usual header, sidebar and footer, etc) – this new page is commonly referred to as an ‘Attachment URL’.
Here’s an example of an Attachment URL produced by this very site (note that this is no-longer a live example since we redirect these to the parent post — see below):
…what a mess!
How to find your own Attachment URLs:
The trick to finding these pages is to take a look at the file name of the media/image and append this file name to the URL of the post in which it’s inserted: i.e. if the file name of the images is, say “editing-the-header” and the post into which it is being used it, say “https://winningwp.com/designmodo-framework-for-wordpress/“, then the corresponding Attachment URL for that images would be at “https://winningwp.com/designmodo-framework-for-wordpress/editing-the-header/” (note that this is no longer a live example since we redirect these to the parent post — see above for a screenshot instead).
What they are not:
It’s worth noting that Attachment URLs are not, as some people seem to think, referring to simply the location of the image itself — here’s an example of a URL referring to simply the location of an image (this is NOT an attachment URL) — https://winningwp.com/wp-content/uploads/2014/09/editing-the-header.png
The perceived issue:
The perceived issue with WordPress creating these ‘extra’ pages though seems relatively clear: Google may index these pages and regard them as low-quality content (since all they contain is a single image with no readable/interesting text etc) – what’s more, if users find such pages (or images) in a Google search and then click through to them they may be quick to leave (since all they find is a single image), thereby increasing your site’s bounce rate.
The benefits of Attachment URLs:
I’m no expert on this particular matter, but I honestly don’t really see how having an entirely new page generated for each piece of media inserted into a post is of any significant benefit at all – apart from that it allows you to refer users to an actual page URL instead of simply giving them the URL of an actual image, etc… …Is this even a benefit?!
So what to do about them:
There are few schools of thought on this: a) leave them be and don’t worry about them too much (hmmm), b) ask search engines to no-index them, or c) redirect them to the original post into which the media was inserted, which is what we do on this very site – with the help of Yoast’s incredibly-popular SEO Plugin: WordPress SEO by Yoast.
Using Yoast’s SEO Plugin to redirect Attachment URLs:
If you’re using Yoast’s SEO plugin, the solution is a doddle: simply navigate to ‘SEO’ → ‘Permalinks’ and check the ‘Redirect attachment URLs to parent post URL‘ checkbox — as shown in the following image:
Problem solved (and yet another reason to use Yoast’s invaluable SEO Plugin)!