How to block access to my site from a specific bux site or any other site with negative traffic

There are situations when negative traffic comes from certain sites, for example, from bux sites or simply from sites that you don't like. In some cases, such traffic can be dealt with, but not always.

Quite often, there are tasks like “go to a search engine, enter such and such a query, go to such and such a site” in bux sites – this is unlikely to be combated, since this request is difficult to distinguish from ordinary traffic.

But if the request is made directly from the bux site, or is shown in an iframe, then this can be dealt with.

Also, if your site has been added to an aggregator or a link is placed on a site that you do not like, then this method will also work.

For example, a bad site is https://site.click/. To block traffic from this site, you can use the following:

RewriteCond %{HTTP_REFERER} https://site.click/ [NC]
RewriteRule .* - [R=404]

These lines need to be written to the .htaccess file. These are the rules for the mod_rewrite module, which is usually enabled in Apache.

In this case, everyone who came from the site https://site.click/ will be shown the message “404 page not found”. If desired, you can put any other response code instead of 404, for example, 403 (access denied), 500 (internal server error) or any other.

If you want to block access from multiple sites, use the [OR] flag, for example:

RewriteCond %{HTTP_REFERER} https://site.click/ [NC,OR]
RewriteCond %{HTTP_REFERER} anotherdomain\.com [NC,OR]
RewriteCond %{HTTP_REFERER} andanotherdomain\.com [NC,OR]
RewriteCond %{HTTP_REFERER} onemoredomain\.com [NC]
RewriteRule .* - [R=404]

Note that the [OR] flag does not need to be specified on the last line.

Instead of displaying an error, you can redirect to any page of your site, for example, in the following case, all users who come from the site https://site.click/ will be sent to the error.html page of your site:

RewriteCond %{HTTP_REFERER} https://site.click/ [NC]
RewriteRule .* error.html [R]

And the following rules set everyone who came from the site https://site.click/ to redirect to https://natribu.org/ru/:

RewriteCond %{HTTP_REFERER} https://site.click/ [NC]
RewriteRule .* https://natribu.org/ru/ [R]

Leave Your Observation

Your email address will not be published. Required fields are marked *