Are you worried about those strange search results that you came across recently upon searching “site:yoursitename” on Google? What worries you is that when you click on those results, a page with only an image and no other content is opened. See how those results appear in the SERP in the image below.-
The above search result opens only an image on a blank page without any other content(text). “make a Pendrive bootable using cmd 1” is actually the name of an image from this post. Such pages are called image attachment pages which add no value to the web.
Image attachment pages affect SEO badly. Visitors hitting blank pages with no actual content will increase the bounce rate of your website. Google doesn’t like unnecessary pages as they don’t have any value to visitors. So it’s better to stop those all unnecessary pages to be crawled and indexed.
WordPress Image Attachment Pages
When you write a post, add an image to it and hit publish button, the WordPress generates 2 different URLs –
- One for the post – let’s say the URL for the post is yoursitename.com/post-title (depending upon the permalink structure of your site)
- Second, for the image, you added – the structure of the URL will be yoursitename.com/post-title/nameoftheimage. These types of pages hold only an image in them and are called image attachment pages. See the demonstration below –
Similarly, when you add 5 images to a post, WordPress creates 6 links – 1 for the post(redirect you to the original post) and 5 for the images(redirect you to 5 different standalone pages containing only an image).
How to Stop Google Indexing Image Attachment Pages?
There are multiple ways to prevent google from indexing image attachment pages. One simplest and preferred method is to do it with the popular plugin Yoast WordPress SEO –
- Install Yoast WordPress SEO plugin (see a guide on how to install a plugin)
- After installation, go to SEO>>Permalinks from the WordPress dashboard. Note: They keep changing the location of this option.
- Check the box – “Redirect attachment URL’s to parent post URL”. and save settings.
Once you’ve done this, anyone who clicks on the page for an image attachment will be taken back to the parent/original post. In order to avoid duplicate content, this setting applies a 301 permanent redirect, which informs Google bots that the page has been moved to a new address.
Alternative – If you are not comfortable with the Yoast SEO plugin then install another dedicated plugin( Noindex Attachment Pages) which is made for only applying the No-Index tag to attachment pages.
What’s next – Don’t think by doing this, all the indexed image attachment pages will disappear suddenly from the SERP. An indexed page may take a couple of days to months to get removed from SERP. The reason for this is that a website owner might select the wrong settings accidentally and all important posts/pages will be removed instantly. This is why Google takes time to remove indexed posts/pages. So wait patiently till Google removes all indexed image attachment pages.
3 thoughts on “Stop Google Indexing Image Attachment Pages in WordPress”
Permalink settings are gone in Yoast 7.x. This is outdated.
It’s still there – SEO>>Search Appearance>>Media>>Media & attachment URLs
I would love to see a test on this.
Take a website with indexed image attachment pages, make them noindex and determine the impact on website performance, if any.