Security problem

Hacked Website SEO Spam Cleanup: Remove Spam Pages and Links

Hacked website SEO spam cleanup means removing the spam pages, links and hidden code an attacker added, closing the way in, and getting Google to drop the spam. Here is how we do it.

The symptoms

What a hacked website looks like in Google

Most SEO hacks are built to stay invisible to the site owner.

Hacked website SEO spam is content an attacker adds to your site to rank their own pages: casino, pharmacy, replica goods or auto-generated Japanese pages. The attacker uses your domain's trust, and Google can label your results, warn visitors or remove pages. Often the owner sees a normal site, because the spam is shown only to Googlebot or to visitors arriving from Google.

These are the places it shows up:

WhereEnglish interfaceArabic interface
Search ConsoleSecurity issues: Hacked: Content injection, Hacked: Code injection, Hacked: URL injection, Malwareمشاكل الأمان
Search ConsoleManual actionsالإجراءات اليدوية
Search ConsoleSettings, Users and permissions: an owner you do not knowالإعدادات، المستخدمون والأذونات
Google results"This site may be hacked" under your resultتحذير تحت نتيجة موقعك
  • A site: search for your domain returns pages in Japanese or about casinos that you never created.
  • The Performance report shows a sudden jump in impressions for unrelated queries in other languages.
  • The Page indexing report grows by thousands of URLs in a few days, or a sitemap you did not submit appears in the Sitemaps report.
  • Mobile visitors coming from Google are redirected to another site, while you see the normal page when you type the address.

Patterns we clean

Typical hack patterns, ranked by how often we see them

All from real cleanups. We do not name the sites.

1. Rogue plugins

A plugin with a harmless-looking name that hides itself from the plugin list, creates admin users and serves spam pages. Must-use plugins are a common hiding place.

2. Casino and gambling spam

Hundreds of posts or generated URLs about betting, or hidden links in the footer pointing to gambling sites, often in Arabic.

3. Japanese keyword hack

Thousands of auto-generated Japanese pages, and often the attacker verifies their own Search Console ownership to submit sitemaps.

4. .htaccess redirects

Server rules that redirect only mobile users or visitors with a Google referrer, or route unknown URLs to a spam script.

5. Cloaking for Googlebot

PHP code that checks the user agent and serves spam only to Googlebot, so the owner never sees it in a browser.

6. Persistence outside WordPress

Files in uploads folders, modified core files, cron jobs or other sites on the same hosting account that reinfect the site after cleanup.

Diagnosis

How we diagnose a hacked site step by step

We find the way in before we delete anything.

01
Snapshot first

We take a full copy of files and database for evidence and rollback, before changing anything.

02
See what Google sees

URL Inspection with a live test shows the page as Googlebot gets it. We compare it with a normal browser request.

03
Scope the spam URLs

We collect spam URL patterns from site: searches, the Performance report, the Page indexing report and server logs.

04
Scan files and database

We compare core files with clean copies, search for obfuscated PHP, check .htaccess, must-use plugins, uploads, users and options.

05
Check the account

We review the hosting account for other sites, cron jobs and SSH keys, and Search Console for unknown owners.

06
Find the entry point

Logs and file dates usually point to the cause: a nulled theme, an outdated plugin, a file manager plugin or a leaked password.

The cleanup

How we clean a hacked website of SEO spam

Remove the infection

  • Delete rogue plugins, unknown admin users and injected code. Replace core files, theme and plugins with clean copies from the official source.
  • Remove spam rules from .htaccess and other server configuration, and remove PHP files from upload folders.
  • Clean the database: spam posts, injected options and scheduled tasks.
  • Close the entry point: update or remove the vulnerable component, and rotate every password, the WordPress salts, the database password and hosting access.

Clean the index

  • Make every spam URL return 404 or 410. Do not redirect spam URLs to the home page, and do not block them in robots.txt, because Google needs to crawl them to see they are gone.
  • Remove unknown Search Console owners and any sitemap they submitted. Submit a clean sitemap, as explained in our guide to robots.txt and sitemap errors.
  • Use the Removals tool only for urgent URLs. It hides them for about six months and does not delete them.
  • When the site is clean, use "Request review" in the Security issues report or the Manual actions report, and describe what was fixed.

Stop it coming back

We add file change monitoring, uptime and server error alerts, and a rule against nulled themes and file manager plugins. Most of the sites we clean run on WordPress, and the hardening is part of our technical SEO service. When the theme is beyond repair, our web development team rebuilds it.

Checklist

Hacked site cleanup checklist

CheckCorrect state
Security issues reportNo issues detected
Search Console ownersOnly known owners and users
Plugins and must-use pluginsOnly known, updated plugins from official sources
Admin usersOnly known users, passwords rotated
.htaccess and server rulesNo conditional redirects or unknown rewrites
Googlebot viewURL Inspection matches what users see
Spam URLsReturn 404 or 410, not in any sitemap
MonitoringFile change and uptime alerts active

Recovery and proof

How long recovery takes

A security review request is usually processed within a few days to a few weeks. Warnings in Chrome and in search results are removed after Google confirms the site is clean. Spam URLs drop out of the index as Google recrawls them, which takes from a few weeks to a few months when there are thousands. Rankings for your real pages return gradually once the spam is gone. If traffic fell during the hack, our traffic drop recovery guide covers the next steps.

Monitoring is what shortens the damage. On the waste management company in Qatar, the problem was not a hack but a plugin that wrote a bad server rule and returned 500 errors for days; alerts and a quick fix protected the growth below. See other problems on the SEO solutions hub.

230
clicks, January 2026 (CS2)
1,820
clicks, September 2026 (CS2)
x15.5
impressions in 8 months

Figures come from Google Search Console of real client properties (monthly web search totals). Results depend on the starting point, the competition and how fast changes are implemented. They are not a promise of the same outcome.

Seeing Japanese or casino pages for your domain in Google? We check what Googlebot sees and where the spam comes from.

Get a free SEO audit

FAQ

Frequently asked questions

How do I know if my site has SEO spam?

Search site:yourdomain.com in Google and look for pages you did not create. Also check the Security issues report and the Performance report for unrelated queries.

Why can't I see the spam pages on my site?

Many hacks use cloaking: the code shows spam only to Googlebot or to visitors from Google. Use URL Inspection with a live test to see what Google receives.

Should I redirect spam URLs to my home page?

No. Return 404 or 410 so Google drops them. Redirecting thousands of spam URLs to the home page can look like soft 404s and keeps them in Google's processing longer.

Will deleting the spam pages remove them from Google immediately?

No. Google drops them as it recrawls each URL. The Removals tool can hide urgent URLs for about six months while that happens.

Is restoring a backup enough?

Only if you also close the entry point and the backup predates the infection. Otherwise the site is usually reinfected within days.

Want to know what is holding your site back?

Send us your website and get a free SEO audit with the first fixes to make.