How to Stop Google from Indexing your WordPress Image Attachment Pages

Stop Indexing WordPress Attachment Pages

Have you every actually checked how your website appears in SERPs? You might want to, especially if you are running WordPress. The reason is that when you upload an image and insert the normal way it creates a separate WordPress attachment page. And if you aren’t careful Google might actually start indexing these pages. You can see below in this picture that is what happened to me.

brand name in serps

You can see above that “raventools” and “google-authorship” are actually the names of two image attachment pages. Example, here is what the raventools link goes to: https://brianjackson.io/adding-keywords-to-raven-tools-ranking-in-bulk/raven-tools.

raven tools

You can see that page is simply the attachment page that is created due to the image upload. Why is this a bad thing? It’s bad because in SERPs you have things showing up that are named wrong. Also, visitors are now hitting pages that are completely blank which may in turn lead to a higher bounce rate.

There are a couple different ways to prevent Google from indexing your WP attachment pages.

Option 1 (preferred method)

The easiest way to fix this is to redirect the WordPress attachment pages to the original page/post. In this example I will show you how to do this using the Yoast SEO plugin. (there is also a similar setting in the All in One SEO plugin)

Step 1

In WordPress click into SEO and then click on “Advanced”

yoast SEO advanced

Step 2

Click into the “Permalinks” tab.

yoast permalinks

Step 3

Then select the box “Redirect attachment URL’s to parent post URL.”

redirect attachment URLs to parent post

Step 4

Then click “Save Changes.”

save changes

So now my raventools attachment page here: https://brianjackson.io/adding-keywords-to-raven-tools-ranking-in-bulk/raven-tools is redirected to the post that the image is on: https://brianjackson.io/adding-keywords-to-raven-tools-ranking-in-bulk/

Option 2

Another way to prevent this from happening is to click into the image attachment page and mark it as no-index within the Yoast plugin.

no-index

Option 3

A third way to prevent this as Olaf mentioned below in the comments is that you could block all of your attachment pages from indexing within your robots.txt file. I prefer option 1 as it is quick and easy.

Option 4

If you don’t want to install or use Yoast, there is also a standalone WordPress plugin called Noindex Attachment Pages.

Now your SERP listings should look cleaner and your visitors won’t be hitting blank pages.

As always feel free to leave your comments below! Make sure to subscribe to my newsletter for more great SEO and WordPress tips.

GET MORE STUFF LIKE THIS

Marketing, WordPress, Blogging Tips, SEO and Reviews, once a week.

Thank you for subscribing.

Something went wrong.

111 Shares
Tweet
Share
Share
Buffer