Refreshing The Google Index After Pharma Hack

The pharma hack is one of the most stubborn hack attacks I have to deal with on WordPress sites for my clients, I’ve written more about it here in my post The WordPress Pharma Hack

Once you have fixed the hack, there is the lingering problem of getting Google to update it’s index and remove all reference to viagra, cialis and all the other disco drugs these scum buckets are trying to pedal.

In this post I want to share with you the techniques I have been using to speed up the process of getting the pharma links removed.

First Up

Make sure you have completely cleaned up the site there are three areas to fix, if you miss one the infection comes back and none of these techniques will help, see my previous post.

It Takes Time

First up I want to tell you there is no quick fix it usually takes a couple of weeks t0 clean the entire index up.  Be patient, it will clean up.

Assessing The Problem

A good way to check the extent of your problem and also measure your solution you need to do a search like this in Google

site:yourdomain.com (viagra | cialis)

This will return a list of all infected pages, it gives a metric you can work on to recover your site. Here is a screen dump from a real site I’ve been working on



Get Inside Google’s Head

Google plays it’s cards close to it’s chest they don’t want people to fully understand their listing process so people cannot game the system for their own ends.

The techniques I’m showing here are what I have found to work, I have no evidence this is the best way to get your site re-indexed, if you have any insight please leave a comment.

Google Webmaster Tools

All of the techniques I’m about to describe happen in the Google webmasters tools system.

Submit A SiteMap

A sitemap is an xml file containing a list of post and pages in your site, if you submit a sitemap it appears that your site is re-indexed more quickly.

I like this plugin to automatically generate the sitemap every time you add a new post or page http://yoast.com/wordpress/seo/

If you go into Google webmasters you can submit a sitemap for your site and get Google to re-index your site

If you already have a sitemap you can re-submit it and hopefully get the same result.

Fetch As Googlebot

Another useful tool  I have found is the fetch as googlebot feature.  If you use this to retrieve your hacked pages, as Google sees them, great to check the hack is gone, but also great to re-submit the page.  Once the post or page is retrieved, there is an option to submit the

I have been going through all the hacked pages from a pharma hack attack fetching them as Google bot and re-submitting,

Removal Tool

You can get google to removed cached copies of a page from the index with this technique.  Go to the following URL


Type in teh post or page with hacked details, Google sees the page is still live and asks you to type in a word that is on the cached page but not on the actual page.  I typed in viagra on my test and the pages are submitted for review.

Wrap Up

A nasty hack with a very slow recovery process, if you have any other techniques for speeding up re-indexing please let me know.

Need More Help Fixing Your Hacked Site?

I’ve create a WordPress Hack Recovery Course


Need Help With Your WordPress Site?

Get a no obligation quote for technical support for your WordPress site. Click Here And Get A Quote

7 Responses to “Refreshing The Google Index After Pharma Hack”

  1. Dan March 13, 2012 at 6:51 pm #

    I just got this cleared up. Nasty little bugger got into my server root and went to town with lots of files and other domains. I had to do a massive find-replace for the base64 encode string.

    You’ve got some great tricks for speeding up the process of being reindexed. Thanks!

  2. Johan April 27, 2012 at 8:48 am #

    Thank you so much for this great post Niel!
    Very much appreciated, as I’m going through this slow process.
    Just asked to get over 30 cached pages removed… phew!
    Just hope this will help, and that Google will listen!

  3. nekton October 1, 2012 at 2:47 pm #

    Great post thank you. My site has a huge number of pages.

    Page 1 of about 1,680 results !

    Is there anyway to clear the cache for multiple pages or the whole site?

    • Neil Matthews October 2, 2012 at 12:22 pm #

      You can request an entire site re-submission from google webmaster tools

      • nekton October 5, 2012 at 11:30 am #

        Awesome – thank you 🙂

  4. Poker on a Mac November 15, 2012 at 5:33 am #

    We were nailed with this nasty little bugger what must have been several years ago now. Not realizing that we hadn’t cleaned it up in its entirety.. I think we are really screwed here.

    Google Webmaster Tools is showing over 9600 pages of content for our site, and has indexed about 3500 of them. Problem is, we only actually have about 500 pages on our site.

    I’ve had 3 experts look into the site and they all agree that it has been removed. However, our rankings dropped off significantly just a few weeks ago and our META data seemed to have gone missing too. The Pharma Hack is still showing up for our site in Google’s index and we can’t figure out an efficient way of removing 9600+ pages from the index.

    Any pointers??

    • Neil Matthews November 16, 2012 at 4:33 pm #

      YOu can request a full re-index from google – give that a try