Fake bots and spam traffic are among the biggest threats to WordPress sites — they consume server resources, skew analytics data, slow down loading times, and can even lead to security breaches or DDoS attacks. Fake bots often scan for vulnerabilities, while spam traffic floods forms, comments, or referral logs with junk. Blocking them not only saves bandwidth but also improves Core Web Vitals, user experience, and SEO by ensuring your site serves real visitors efficiently.
At Cope Business, we block bots and spam as a standard step in our technical SEO audit services and WordPress speed optimization services, helping clients reduce unwanted traffic by 50–80% while maintaining performance for legitimate users.
This guide explains why blocking is crucial, and provides four proven methods to block fake bots and spam traffic in WordPress — using plugins, .htaccess, hosting tools, and best practices.
Why Block Fake Bots and Spam Traffic in WordPress?
- Resource Savings: Bots can make up 40–60% of traffic, wasting CPU/bandwidth
- Better Security: Prevents vulnerability scanning, brute-force, and injection attacks
- Accurate Analytics: Clean data in Google Analytics (no fake referrals or sessions)
- SEO Boost: Faster site = better rankings; no penalties from spam associations
- Cost Reduction: Lower server load means cheaper hosting
- User Protection: Stops spam comments/forms from cluttering your site
Ignoring bots/spam can lead to inflated bills, blacklisting, or full hacks — block them early.
Method 1: Using a Security Plugin (Easiest & Comprehensive)
Security plugins offer real-time detection and automatic blocking.
Recommended Plugin: Wordfence (Free/Pro)
Wordfence is the gold standard for bot/spam protection.
Steps
- Install Wordfence Security (free) from Plugins > Add New.
- Activate → Run the setup wizard (enable firewall, scans).
- Go to Wordfence > Firewall > Firewall Options:
- Enable Brute Force Protection (lock out after X failed logins)
- Set Rate Limiting for bots/crawlers (throttle aggressive ones)
- Go to Wordfence > Blocking:
- Block specific IPs, countries, or user agents (e.g., fake Google bots)
- Use Live Traffic View to monitor and block in real-time
- For spam: Wordfence > Login Security → Enable CAPTCHA on login/forms.
- Save — Wordfence auto-blocks fake bots and spam.
Pro Version (~$99/year): Adds country blocking, premium rules, 2FA.
Alternative Plugin: Sucuri Security (free) — Cloud-based firewall + bot mitigation.
Pros: Automatic alerts, detailed IP info, easy setup.
Cons: Free version has basic blocking (Pro unlocks more).
Method 2: Using .htaccess Code (Lightweight – Server-Level)
Block bots/spam at the server level with .htaccess (Apache hosts).
Steps
- Access .htaccess in root folder via FTP or hosting file manager (backup first!).
- Add this code to block common fake bots/user agents:
text# Block Fake Bots & Spam Traffic RewriteEngine On RewriteCond %{HTTP_USER_AGENT} (badbot|evilspider|fakegooglebot|semrushbot|ahrefsbot|majestic|rogerbot|mj12bot|dotbot|spbot|linkpadbot|exabot|opensiteexplorer|megaindex|backlinktest|mojeekbot|seznambot|uptimerobot|meanpathbot|linkdexbot|seostar|seoprofiler|seokicks|seomoz|rogerbot|majestic|ahrefs|semrush|megaindex|blexbot|turnitinbot|dotbot|exabot|mj12bot|spbot|linkpadbot|opensiteexplorer|backlinktest|mojeekbot|seznambot|uptimerobot|meanpathbot|linkdexbot|seostar|seoprofiler|seokicks|seomoz|rogerbot|majestic|ahrefs|semrush|megaindex|blexbot|turnitinbot) [NC] RewriteRule ^ - [F,L] # Block Referrer Spam RewriteCond %{HTTP_REFERER} (spam-site1.com|spam-site2.com|buttons-for-website.com|semalt.com|darodar.com|7makemoneyonline.com|ilovevitaly.ru|econom.co|savetubevideo.com|kambasoft.com|buttons-for-your-website.com|best-seo-solution.com|best-seo-offer.com|100dollars-seo.com|trafficmonetize.org|success-seo.com|semaltmedia.com|blackhatworth.com|4webmasters.org|ranksonic.info|rankings-analytics.com|adviceforum.info|videos-for-your-business.com|video--production.com|social-buttons.com|sharebutton.net|buy-cheap-online.info|site3.free-share-buttons.com|webmaster-traffic.com|free-social-buttons.com) [NC] RewriteRule ^ - [F,L] # Block Fake Google Bots RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*Googlebot [NC] RewriteCond %{HTTP_USER_AGENT} !googlebot.com [NC] RewriteRule ^ - [F,L]
- Customize: Add more bad user agents/referrers from your logs (use tools like AWStats or Google Analytics).
- Save → Test your site — legitimate traffic is unaffected.
For NGINX: Contact your host or add to server config:
text
if ($http_user_agent ~* (badbot|evilspider)) {
return 403;
}
Pros: Server-level blocking, very effective, no plugins.
Cons: Requires .htaccess access; list needs occasional updates.
Method 3: Using Cloudflare or Hosting Firewall (Cloud-Based Protection)
Many hosts and CDNs have built-in bot blocking.
Steps for Cloudflare (Free Plan Works)
- Sign up for Cloudflare (free) → Add your site → Update DNS.
- Go to Firewall > WAF Rules → Create custom rule for bots.
- Use Managed Rules: Enable Bot Fight Mode (free) or Super Bot Fight Mode (Pro).
- For spam: Firewall > Managed Rules → Enable rules for known bad bots.
- Monitor: Firewall > Overview → See blocked requests.
Alternative: SiteGround Security, Bluehost ModSecurity, or Sucuri Firewall (paid ~$199/year).
Pros: Cloud-level filtering, no server load, global protection.
Cons: May require DNS changes; over-blocking possible (whitelist if needed).
Method 4: Block Spam Forms & Comments (Targeted Protection)
For spam-specific traffic.
Steps
- Install Akismet (free for personal sites) or CleanTalk (paid) for comment spam.
- For forms: Use WPForms with reCAPTCHA v3 or hCaptcha.
- Block referral spam: Add to .htaccess:
textRewriteCond %{HTTP_REFERER} badreferrer.com [NC,OR] RewriteCond %{HTTP_REFERER} spamdomain.com [NC] RewriteRule ^ - [F,L]
- Monitor with Google Analytics → Behavior > Site Content > All Pages → Filter by spam referrers.
Best Practices for Blocking Bots & Spam
- Identify Bad Traffic: Use Wordfence Live Traffic or Google Analytics to spot patterns (e.g., unusual IPs, high bounce rates).
- Whitelist Good Bots: Allow Googlebot, Bingbot — add exceptions in .htaccess:
textRewriteCond %{HTTP_USER_AGENT} !(Googlebot|Bingbot|Yahoo|Slurp) [NC]
- Regular Updates: Update your block list from security blogs or tools like Fail2Ban.
- Performance: Blocking reduces load — pair with caching.
- SEO: Blocked bots don’t affect rankings; focus on good bots like Googlebot.
- Test: After changes, verify your site loads normally; use tools like GTmetrix.
Blocking fake bots/spam can cut unwanted traffic by 50–80% — freeing resources for real users.
Final Thoughts
Blocking fake bots and spam traffic in WordPress protects your site’s performance, security, and SEO. Use Wordfence for comprehensive protection or .htaccess for lightweight blocking — both are effective and easy to set up.
Prevention is better than cure — secure your site today.
Experiencing bot attacks or spam? Need a full security audit? Contact Cope Business for a free technical SEO consultation — we’ll analyze your traffic, block the bad stuff, and optimize your site for speed and safety.




