If you’ve ever dealt with a hacked WordPress site, you know how frustrating and damaging it can be. Recently, we tackled a massive Japanese SEO spam attack where more than 242,000 spam pages were indexed in Google. The challenge was not just removing the malicious content but also ensuring that it didn’t come back.

Here’s how we cleaned up the site and removed the spam pages from Google in just 10 hours.


Step 1: Cleaning Up the Malware

Before dealing with the indexed spam pages, we first focused on cleaning up the malware to stop the spam from regenerating:


Step 2: Analyzing the Hack

The next step was to analyze the structure of the hacked URLs. After scanning the site, we identified a pattern in the spam URLs:

https://domain.com/ahqdr/
https://domain.com/daaqx/
https://domain.com/jpkdf/
https://domain.com/qwerty/
https://domain.com/xyz123/

Most of these spam pages were generated in bulk and hosted on randomly generated subdirectories. The key observation was that all the spam URLs ended with .htm or .html.


Step 3: Removing Indexed Spam Pages from Google

To get these pages deindexed from Google quickly, we used Google Search Console (Webmaster Tool):

  1. Navigate to: Removals → New Request → Remove all URLs with this prefix.
  2. Submit the following prefixes:
https://domain.com/ahqdr/
https://domain.com/daaqx/
https://domain.com/jpkdf/
https://domain.com/qwerty/
https://domain.com/xyz123/
https://domain.com/*.htm
https://domain.com/*.html

This process told Google to remove those indexed spam URLs immediately.


Step 4: Adding a Robots.txt File

To prevent further indexing of these spam pages, we added the following robots.txt file in the site’s root directory:

User-agent: *
Disallow: /*.html$
Disallow: /*.htm$

This blocks all search engine crawlers from accessing any pages that end with .html or .htm, ensuring that no new spam pages get indexed.


Step 5: Strengthening Security

To prevent future attacks, we took additional security measures:


Final Results

If your WordPress site has been hacked and is showing thousands of spam pages in Google, act fast! Removing the spam quickly can prevent your domain from being blacklisted. Need help? Contact us today for professional WordPress security and malware removal services.

Leave a Reply

Your email address will not be published. Required fields are marked *