Atakan Recovery Services

Guides · 5 min read

Website redirecting to spam or another site: find and fix the hack

Hacked sites often look normal to their owners: the redirect may only fire for visitors from Google or for certain devices. Confirm the hack safely, find the way in, clean everything, then ask Google to review.

Last updated:

In short

Why does my website redirect to another site?

Usually because an attacker injected code: a redirect rule in a server configuration file such as .htaccess, a JavaScript redirect, a script loaded from another site or obfuscated code. Google says hackers often target only certain referrers or user agents, such as visitors from Google Search, so the owner may not see it.

Official facts at a glance

  • Google security review of a hacked site:Several days to weeks; a malware review from a few days to a few weeks. Source: support.google.com

Timelines on every platformSupport channels on every platform

Signs your site has been hacked

  • Visitors from search results land on spam, gambling or scam pages
  • Search results show pages or text you didn't create
  • Google Search Console's Security issues report lists hacked content, malware or social engineering
  • Browsers or search results show a warning for your site

Confirm it safely

Google advises against opening infected pages directly in your browser: malware can exploit browser vulnerabilities, and hackers may hide the spam from site owners. It suggests two safer methods:

  • The URL Inspection tool in Search Console, which shows the page as Google sees it
  • cURL or Wget from the command line, with a Google referrer or a different user agent to trigger the hidden behavior

Where the malicious code hides

Google says hackers typically get in through a directory with open permissions, outdated software such as an old WordPress, Drupal or Joomla! version, or a hacked third-party plugin. Look in these places:

  • Server configuration files such as .htaccess or httpd.conf (redirects in the server response)
  • JavaScript redirects in pages or templates
  • Scripts loaded from another site
  • Obfuscated code: Google suggests searching for terms such as eval, base64_decode and unescape
  • New pages created by the attacker, or spam links and text added to existing pages

Clean up: step by step

  1. 1Find and close the way in: update the CMS, plugins and themes, and change every admin and hosting password.
  2. 2Replace affected files with the last good backup, or remove the injected code, pages and links yourself.
  3. 3Search the whole site, including a site: search on Google, for other hacked pages: Google says fixing only some pages won't earn a partial return to search results.
  4. 4Test again with the URL Inspection tool and cURL.
  5. 5Request a review in the Security issues report, explaining the problem, the steps you took and the result.

After you request the review

Google says reviews can take several days or weeks, and a malware review from a few days to a few weeks. You get an email when the review starts and when it ends. Don't resubmit before a decision: a request for a site that isn't fixed can lengthen the next review or get the site marked as a repeat offender.

Frequently asked questions

I can't see the redirect myself. Is my site really hacked?

Possibly. Google says its warnings depend on the browsing context and that hackers target specific referrers or user agents, so you may not reproduce it. Rely on the Security issues report and test with URL Inspection or cURL.

Is restoring a backup enough?

Only if the backup is clean and the way in is closed. Google allows either replacing affected files with the last good backup or removing the spam yourself, but if the vulnerability stays, the same attack can come back.

Can you clean the site without my password?

Yes. You create a separate user for us on your hosting or CMS and delete it afterwards. See our hacked website service.

Official sources

The platforms' own help and policy pages. We are not affiliated with them.

Related services

Tell us what happened.

The assessment is free and there is no obligation. If we can't help, we will tell you.

We never ask for your password or verification codes.

Atakan Recovery ServicesWhatsApp

Hi, my Instagram account was suspended yesterday.10:24 ✓✓

Thanks for reaching out. Send us a screenshot of the notice and we'll check which official route is still open. The assessment is free.10:26

We never ask for your password or verification codes.

Illustrative example. Every case is different.
Chat on WhatsApp
Free assessmentWhatsApp