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
- 1Find and close the way in: update the CMS, plugins and themes, and change every admin and hosting password.
- 2Replace affected files with the last good backup, or remove the injected code, pages and links yourself.
- 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.
- 4Test again with the URL Inspection tool and cURL.
- 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
Hacked website cleanup
Website hacked, redirecting visitors or flagged by Google? We remove the malicious code, close the way in, restore clean files and request Google's review.
BeforeRedirects to spamAfterClean againHow we handle itBusiness email deliverability
Company emails not reaching customers or landing in spam? We read the bounces and set up SPF, DKIM and DMARC to Gmail and Yahoo's requirements, then test.
BeforeIn spamAfterIn the inboxHow we handle it