How to Stop Media Attachments Being Indexed?

So you may have noticed in the last month or so that a lot more URL’s are being indexed by Google on your site? If so you’re probably searching for a solution.

Now I’m not blaming anyone, someone said it was a core WordPress update that caused this problem, others are blaming the Yoast Plugin and I’ve seen Joost from Yoast telling people that it wasn’t a bug on Yoast and that it was something to do with the WordPress core, sadly I’m not an expert on the WordPress core or Yoast but it isn’t about who to blame, its about how to resolve the issue.


Now regardless of whether a Yoast update went wrong, or whether it was a WordPress core problem, there was an issue and it had to be resolved, no-one wants to have a ton of media attachment URL’s being indexed by the search engines diluting the power of their SEO.

I believe Yoast now has a setting now on their plugin which resolves this issue with WordPress‘s core update in their new 7.0 update so it does look like the problem has been resolved if you are a Yoast user, but I’m pretty sure there are people who don’t search their console or update their plugins as frequently as others and may be suffering as a result, so this is why it is always wise to check your stats whether it’s rankings, search console or however else you monitor your website.

So we have people’s website rankings tank as a result of these media attachments being indexed, as many of you SEO‘s will know there is absolutely no need for those URLs to be crawled and indexed and many of the SEO plugins ensured that this didn’t happen as part of their default settings.

Getting Pages Deindexed by Google

It’s fairly easy to get pages onto Googles index but in the past, I’ve had massive problems getting pages de-indexed. It’s certainly a lot harder than you would imagine, but until you have some kind of problem then you may not have experienced that yet but I’m sure you will come across this at some point in your SEO career.

How to Resolve this Issue?

I’ve heard people were trying to remove URL’s via their search console but those trying that method were not getting any results.

Others no indexed, no-followed the URL’s in question, but because Google had already crawled and indexed them these URL’s seem to stick on Googles index and that leaves us with the same problem, those URL’s remain indexed so people started to panic and tried a whole bunch of weird and wonderful fixes, but the answer is really simple.

The quick and easy way to get rid of URLs that have already been indexed by Google would be to put a 410 status code on any URL that you want to drop out of Googles index, this typically tells Google the page is gone and it will within days drop from Googles index. Now you may have a big website and have thousands of URL’s for Google to de-index, if that’s the case it can take a few weeks for Google to get round to all of them but you should very quickly start to see an impact as a result of implementing the 410 status code on your URL’s.

How is the 410 Status code implemented?

Well, you can go via your htaccess file, or you can use a simple WordPress plugin called 410 for WordPress and this is something that is simple and easy to use. You can manually put all of the URL’s into the plugin and you do have the ability to do a wildcard 410 for all URLs for example: Use * as a wildcard character. So*/music/ will match all URLs ending in /music/

manually add urls

This will quickly get your URL’s de-indexed using a simple and easy plugin. Any questions on this subject do feel free to get in touch with me and I’ll be more than happy to advise.



seo profile image

Craig Campbell

I am a Glasgow based SEO expert who has been doing SEO for 18 years.

  • social media icon
  • social media icon
  • social media icon

Online Courses