Alish
Alish

Reputation: 240

How to Stop Fake Traffic Bot with htaccess

I am worried about my website because of Some fake traffic showing in analytics social/Facebook, but in detail, bot picks fake wrong URL on my site randomly like this example.com/page?=__HzoblPdx but actual URL is example.com/page/HzoblPdx/title-title. I want to block this link page?=__HzoblPdx.

Anyone help me to solve this issue?

Upvotes: 2

Views: 1186

Answers (3)

MrWhite
MrWhite

Reputation: 45988

Try the following using mod_rewrite, near the top of your .htaccess file:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^=_
RewriteRule ^ - [F]

This blocks (403 Forbidden) any requested URL that contains a query string that starts =_.

Although, the fact that this URL parameter maps to the real URL looks like it might be a misconfiguration error, which the bots have been able to find?

Upvotes: 0

Joe
Joe

Reputation: 4897

You can do that quite easily by using the following in your .htaccess file:

RewriteEngine on
Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} domain\.com/page\?=__HzoblPdx [NC,OR]
RewriteCond %{HTTP_REFERER} www\.domain\.com/page\?=__HzoblPdx [NC]
RewriteRule .* - [F] 

This will block access to any bots trying to access through that domain. Make sure you clear your cache before testing this.

Upvotes: 3

delboy1978uk
delboy1978uk

Reputation: 12382

Check the apache access logs and check the user agent string of the visitor trying to access the non existant page. You can use robots.txt to block certain user agents altogether.

You can get lots of info on robots.txt from google. Here's one site all about it that you can have a read of. http://www.robotstxt.org/

Upvotes: 1

Related Questions