Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Site hacked with spam pages or cloaked redirects: find and fix

SEO-312High impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

Attackers break into a site through an outdated plugin, a weak password or a stolen login. They then add pages or code that serve their own purposes. Common forms are thousands of spam pages (often pharmacy, casino or foreign-language product pages), hidden links to other sites, and cloaked redirects. Cloaking means the site shows different things to different visitors. You, typing your address directly, see a normal page. A person arriving from a Google result, or Googlebot itself, gets the spam or a redirect.

Why it costs you leads or sales

Visitors from search land on scam or unrelated sites instead of your offer, so leads and orders stop while the site looks fine to you. Google may also label results with a hacked warning, or drop your pages. Spam pages dilute your real content, and browsers can show a red warning screen that stops people entering at all. Recovery takes time, so every day matters.

What a cloaked redirect does to a search visitor
  1. Google resultPerson clicks your listing
  2. Injected codeChecks referrer or user agent
  3. Spam siteVisitor is sent away
  4. Lead formNever seen

The owner types the address and sees nothing wrong. Search visitors never reach the funnel.

Organic leads per week after a hackExample numbers
Organic leads per week after a hack (example)Before hack: 40 leads; Week 1 hacked: 12 leads; Week 3 hacked: 3 leads; After cleanup: 30 leads015314012330Before hackWeek 1 hackedWeek 3 hackedAfter cleanupleads

Example: illustrative numbers showing leads falling once search visitors are redirected, and recovering after cleanup.

How to check if your site has it

Checks you can run today
  1. Open Search Console Security issues

    In Google Search Console, go to Security & Manual Actions, then Security issues. Google lists hacked content or malware it has found. Also check Manual actions.

  2. Search Google for spam on your domain

    Search site:yourdomain.com with words like viagra, casino, loan, replica, or foreign characters. Unknown pages in the results are a strong sign.

  3. Test as a search visitor

    Open a private window, search for your brand on Google and click your result. Do it on a phone too. Compare with typing the address directly.

  4. Inspect the page as Googlebot sees it

    In Search Console use URL Inspection, then View crawled page and Test live URL. Compare the HTML and screenshot with what you see.

  5. Check the Pages report

    Under Indexing, Pages, look for a sudden jump in indexed URLs or odd URLs you never published.

  6. Look for unknown files and users

    List admin users, recently changed files, and unfamiliar files in your web root. Check .htaccess and index.php for code you do not recognise.

Find recently changed files and common injection patterns (SSH access, WordPress example)bash
# Files changed in the last 7 days
find . -type f -mtime -7 -name '*.php'

# Suspicious functions often used to hide malicious code
grep -rlE 'eval\(base64_decode|gzinflate\(base64_decode|str_rot13' .

# Check for rogue redirect rules
grep -n -i 'RewriteCond.*(google|bing|referer)' .htaccess

How to fix it

Clean up and secure the site
  1. Take a full backup of the infected site

    Keep a copy for investigation, then work on a clean restore. Tell your host; many offer malware scans or a restore.

  2. Restore from a clean backup if you have one

    Pick a backup from before the first sign of the hack. Then apply all updates before going live, or the same hole stays open.

  3. Otherwise remove the malicious code

    Replace core files, themes and plugins with fresh copies from official sources. Remove unknown files and plugins. Review .htaccess, wp-config.php and the uploads folder, where PHP files should not live.

  4. Remove unknown users and rotate every secret

    Delete rogue admin accounts. Change passwords for the CMS, hosting, FTP/SFTP, database and email. Replace API keys and the salts in wp-config.php. Turn on two-factor sign-in.

  5. Update everything and remove unused software

    Update the CMS, themes and plugins. Delete anything you do not use, and replace abandoned plugins.

  6. Remove spam URLs from Google

    Make the spam URLs return 404 or 410. Use the Removals tool in Search Console for urgent cases, and remove any spam sitemap you find.

  7. Request a review

    If Search Console shows a Security issue or manual action, fix it, then use Request review and describe what you cleaned and how.

Platform specifics
  1. Reinstall core and check users

    In Dashboard, Updates, choose Re-install version. Check Users for unknown administrators and delete them.

  2. Replace plugins and themes

    Delete and reinstall each plugin and theme from the official source. Remove nulled (pirated) themes or plugins, a common entry point.

  3. Scan and harden

    Run a security plugin scan, check wp-content/uploads for .php files, disable file editing with define('DISALLOW_FILE_EDIT', true); in wp-config.php.

How to confirm it's fixed

Confirm the clean-up
  • Search Console shows no Security issues and no Manual actions
  • site: searches no longer show spam pages (allow time for Google to recrawl)
  • Clicking your result from Google on desktop and mobile lands on your real page
  • URL Inspection live test shows the same HTML as a normal visit
  • No unknown admin users, plugins or recently changed files
  • All passwords and keys changed, two-factor sign-in on
  • Your lead form and checkout still work end to end

How to prevent it happening again

Hardening routine
  • Turn on automatic updates for core, themes and plugins where safe
  • Delete unused plugins, themes and old staging copies
  • Never use nulled or pirated themes and plugins
  • Use unique strong passwords and two-factor sign-in for every admin
  • Give each person the lowest access role they need
  • Keep off-site backups and test a restore
  • Add Search Console email alerts to a shared inbox, not one person
  • Review admin users and Custom HTML tags every quarter
Hacked versus recovered

Hacked

  • Unknown pages indexed in Google
  • Search visitors redirected
  • Owner sees nothing wrong
  • Unknown admin user exists

Clean

  • Only your pages appear in site: searches
  • Search visitors reach your funnel
  • Search Console shows no security issues
  • Access limited and protected by two-factor sign-in

How FunnelGuard handles this

FunnelGuard does not check for hacked content, spam pages or cloaked redirects today. It is a possible future check. Do not rely on it for this problem.

What it does cover nearby: a robot visitor runs your real journeys, such as lead forms, checkouts and booking buttons, on a schedule. If a hack breaks a form or a step, the failure is re-checked from a second region and you get one alert with a screenshot and a likely cause. It also checks tracking hits and whether test leads reach your inbox and CRM. That can reveal damage, but it will not tell you that a hack is the reason.

Questions people ask

How do I know if my website has been hacked with spam pages?

Check Google Search Console under Security & Manual Actions, then search site:yourdomain.com for words like casino, pharmacy or foreign characters. Unknown pages in results, a sudden rise in indexed URLs or odd admin users all point to a hack.

Why does my site redirect only when I come from Google?

Injected code is probably checking the referrer or user agent and redirecting search visitors while showing you the normal page. Test in a private window by clicking your Google result, and inspect .htaccess, theme files and plugins for redirect code.

Can I fix a hacked site by deleting the spam pages?

Not on its own. The attacker's backdoor, weak password or outdated plugin remains, so the pages come back. Remove the malicious code and unknown users, update all software and change every password too.

How do I get Google to remove the hacked warning?

Clean the site and close the hole, then open Security issues in Search Console and choose Request review, explaining what you fixed. Google rechecks and, if clean, removes the label. It can take days.

What is the Japanese keyword hack?

It is a hack that creates many pages with Japanese text, often selling counterfeit goods, which then get indexed under your domain. It is cleaned the same way as other spam hacks: remove the injected files, fix the entry point, and ask Google to reindex.

How did my site get hacked in the first place?

Common causes are outdated plugins or themes, pirated (nulled) add-ons, reused or weak passwords, and stolen logins. Server logs and file change dates can show the first suspicious request.

Does FunnelGuard detect hacked sites?

No. FunnelGuard does not check for hacked content or cloaked redirects yet. It monitors your funnels, tracking and lead delivery, which can show symptoms, so pair it with Search Console and a malware scanner.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.