Skip to content

Casino Redirect Hack in WordPress: Full Cleanup & Prevention Guide

4 min read
Casino Redirect Hack

What Is the Casino Redirect Hack?

The casino redirect hack is a malware infection that makes a normal WordPress site send visitors to gambling, adult or phishing sites. It usually hits people who arrive from search engines or on mobile.

It rarely changes what you see when you visit your own site. It targets:

  • Search engine visitors (Google/Bing)
  • Mobile users
  • Logged-out users

Showing different content to different visitors is called cloaking. It keeps the hack hidden until your rankings drop or users complain.

Why Do Hackers Use Casino Redirects?

It is almost always about money from affiliate spam. Hackers take your traffic and send it to casino or gambling affiliate pages. They get paid, and you lose:

  • Trust
  • Rankings
  • Conversions

They use your domain's good SEO reputation to look legitimate to Google and to your visitors.

Common Entry Points for This Hack

Entry Point Description
❌ Nulled Themes/Plugins Inject malicious scripts or backdoors
🐌 Outdated Plugins Vulnerabilities exploited via automation
🤫 Weak Login Credentials Brute force or leaked credentials used
🎯 Vulnerable Hosting Poor server security or shared environments
🔙 Reused Infected Backups Reinfection from compromised backup files

Symptoms of the Casino Redirect Malware

🔎 User-Facing Symptoms

  • The site redirects to gambling or adult sites (for example 1xbet.com, gambling-portal.biz)
  • It only happens on mobile, from search engines or when logged out
  • The page flickers before the redirect

🛠️ Technical Signs

  • JavaScript or iframe redirects injected into header.php, footer.php or functions.php
  • Changes to wp-config.php or .htaccess
  • Suspicious or scrambled PHP files such as wp-tmp.php, wp-fix.php or config2.php

Code that behaves differently depending on the user agent or IP:

if (strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') !== false) { ... }

How to Confirm You’re Hacked

  1. Visit your site in incognito mode, on a phone and from Google search results
  2. Run online scanners such as SiteCheck by Sucuri and VirusTotal
  3. Check the redirect by requesting your site as Googlebot:
curl -A "Googlebot" https://yoursite.com
  1. Look for odd rules in .htaccess. A cloaked redirect looks like this. The destination is whatever domain the attacker is paid to send your visitors to:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ...
RewriteRule ^(.*)$ http://example-casino-domain.test [R=302,L]

Step-by-Step Guide: Remove the Casino Redirect Hack

Step 1 – Backup Everything (Even If It's Infected)

  • Download all files over FTP/SFTP
  • Export your database in phpMyAdmin
  • Name the backup "infected-" so you know what it is

Step 2 – Scan and Remove Malware

Use a malware plugin, or check by hand:

✅ Recommended Tools:

  • Wordfence Security: full file scanning and malware removal
  • MalCare: one-click cleanup (premium)
  • ML-based detection, such as CleanTalk Anti-Spam + Firewall

🔍 Check These Files by Hand:

  • /wp-config.php
  • /index.php
  • /wp-content/themes/your-theme/functions.php
  • .htaccess
  • Random files inside /uploads/ or /wp-content/
  • Search for base64_decode, eval(, gzuncompress, or preg_replace with the /e modifier

Step 3 – Check .htaccess for Redirects

Clean the file, or reset it to the WordPress default:

# Default WordPress .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Step 4 – Review Database for Injected Redirects

Run this SQL query:

SELECT * FROM wp_options WHERE option_value LIKE '%casino%' OR option_value LIKE '%iframe%';

Search the wp_posts table too, for hidden iframes or encoded scripts.

Step 5 – Remove Unknown Admins & Backdoors

  • Go to Users > All Users and look for admin accounts you don't recognise
  • Remove unfamiliar cron jobs in cPanel, or list them with crontab -l
  • Check wp-content/plugins/ and mu-plugins/ for plugins you don't recognise or fakes

Step 6 – Re-secure Your Site

✅ Reset all passwords (WordPress, FTP, database) ✅ Update all themes, plugins, and core files ✅ Reinstall clean theme/plugin copies from official repositories

How to Prevent Casino Redirect Malware

Protection Step Tool
🔐 2FA Login Security Wordfence, iThemes Security
🔄 Auto-updates Enable for plugins/themes
📦 Use Only Trusted Plugins No “nulled” themes ever
🧱 Firewall Cloudflare WAF or Wordfence Firewall
🔄 Off-site Backups UpdraftPlus, BlogVault
🧑‍💻 Server Hardening Disable file editing, limit access

Google Search Console: Clean Up SEO Damage

  1. Submit a clean sitemap
  2. Use the “Removals” tool to remove the spam URLs from Google
  3. Request a Security Review if Google flagged your site

Final Thoughts: A Redirect Is a Red Flag

If your site sends visitors to gambling or adult sites, the attacker has deep access to it. Redirect hacks are common, and they usually come with backdoors, cloaked code and spam pages in Google.

Clean out every part of the infection. Then lock down your WordPress site straight away, so the hack doesn't come back.

Work with us

Is your WordPress site sending visitors to a casino?

Send us the site address and, if you can, the page and device where the redirect happens. We find the backdoor as well as the redirect, so it does not come back, and clean up what Google has indexed. Cleanup is billed at €25 to €45 an hour, quoted first, and we reply within one business day.

Want this done properly on your own site?

Start a conversation ↗