Lorixen.
EN

Site sends mobile visitors to spam? Find the sneaky redirect

Short answer: If customers say your site sends them to a prize scam, adult site or fake app store when they tap your Google result on a phone, but it looks fine when you type the address on your computer, your site has probably been hacked with a conditional ("sneaky") redirect. The malicious code only fires for certain visitors, typically mobile users arriving from a search engine, so you won't see it in normal testing. Reproduce it by imitating a phone and a Google referrer, find the injected code in server configuration, theme files, plugins or the database, remove it and the way in, then ask Google to review the site.

What's happening

Google's spam policies describe sneaky redirects as sending visitors to a different URL than the one they requested, maliciously, to show users and search engines different content or to show users unexpected content. One of the examples Google gives is exactly this pattern: showing desktop users a normal page while redirecting mobile users to a completely different spam domain.

Attackers make the redirect conditional to avoid being noticed. Common conditions:

  • Device: only phones and tablets.
  • Referrer: only visitors arriving from Google, Bing or social media, not those typing the address.
  • First visit only: a cookie stops the redirect repeating, so a second visit looks normal.
  • Not logged in: site admins are excluded.
  • Time or location: only some hours or countries.

Google's help for the Search Console Security Issues report notes that hackers often target only specific user agents or referrers to avoid detection and select targets, and suggests tools that let you specify referrer and user-agent information to mimic a target.

Step 1: Reproduce it

  • Use a private window on your phone on mobile data, search Google for your business, and tap the result. Try a few times over a day.
  • Imitate a phone and a referrer using command-line tools such as curl with a mobile user-agent and a Google referrer, and watch for redirect responses.
  • Check Search Console for a Security Issues message and example URLs.
  • Ask customers for the address they ended up at and the device they used.

Step 2: Find the code

Look in these places, roughly in order:

  1. Server configuration files such as .htaccess on Apache sites. Look for rewrite rules mentioning mobile user agents, search engines in the referrer, or unknown domains.
  2. Theme files, especially the header, footer and functions files, for obfuscated code, long encoded strings or calls to unfamiliar domains.
  3. Plugins and extensions, including ones you don't recognise or that were added recently. Some fake plugins hide from the admin list.
  4. The database, in site settings, widgets, post content and options tables, for injected script tags.
  5. Core files, by comparing them with clean copies of your platform's version.
  6. Third-party scripts loaded from external domains, including ad and analytics tags.

Check file modification dates for clues, but don't rely on them; attackers can fake them.

Step 3: Remove it and close the door

Removing the redirect alone usually isn't enough. Also:

  • Restore platform, theme and plugin code from clean sources.
  • Remove unknown admin users and check other user accounts.
  • Update everything, and delete unused plugins and themes.
  • Change passwords for admin accounts, hosting, database and file access, and turn on two-factor authentication.
  • Check scheduled tasks on the server for jobs that re-add the code.
  • Scan the server and keep backups of the infected state for investigation.

If you don't have someone confident with this, bring in help. Leftover backdoors are common.

Step 4: Ask Google to review

Google's Security Issues help says that once you confirm the problem is fixed, you should request a security review in the report, and that a review can take from a few days to a few weeks. Only request it when you're sure the site is clean, including all the conditional cases.

Step 5: Watch for it coming back

  • Repeat the mobile-and-referrer test weekly for a while.
  • Set up file-change monitoring on configuration and theme files.
  • Keep Search Console notifications going to someone who reads them.

Legitimate redirects that look similar

Not every mobile redirect is a hack. Google's spam policies list legitimate reasons to redirect, such as moving to a new address. Some older sites still send phones to a separate mobile site like m.yourdomain, and some apps send visitors to an app store or app-install page. These go to your own domains or official app stores and happen for everyone on that device. If the destination is a domain you don't own, a scam page, or only appears after arriving from search, treat it as malicious.

Tell customers and staff

While you're investigating, tell staff what customers might report and where to send those reports. If customers may have entered personal or payment details on a scam page they reached via your site, a short, honest note explaining what happened and what to watch for maintains trust. Keep a record of reports with times and devices; it helps confirm when the problem started and when it stopped.

An illustrative example

A hypothetical Leeds dental practice heard from two patients that its Google result opened a "You've won a phone" page on their iPhones. Staff couldn't reproduce it on office computers. The developer used curl with an iPhone user-agent and a Google referrer and saw a redirect. The cause was a rewrite rule added to .htaccess plus a hidden plugin that re-added it. Both were removed, all plugins reinstalled from clean sources, an outdated slider plugin updated, credentials changed, and a review requested in Search Console.

FAQ

Why can't I see the redirect myself?

Because the code excludes you: wrong device, no search referrer, or logged in as admin.

Will this hurt my rankings?

Google may show warnings or reduce visibility for hacked sites. Fix it quickly and request review.

Is my customers' data at risk?

Possibly. Treat it as a security incident and check what the attacker could reach.

Could my host have done this?

Unlikely. It's usually a vulnerable plugin or stolen password.

If your site redirects some visitors somewhere it shouldn't, tell us what device and route they used.

Sources

WhatsAppBook a call