2

I get thousands of server requests from "clients.your-server.de"

i use these code in htaccess to block bots and spiders, but i did not know if the two first lines of code will work ...

Is it even possible to block a server request using the hostname? Is the code correct? How do you block hostnames?

Deny from clients.your-server.de
Deny from your-server.de


<IfModule mod_geoip.c>
GeoIPEnable On
SetEnvIf GEOIP_CONTINENT_CODE SA Block
SetEnvIf GEOIP_CONTINENT_CODE AF Block
SetEnvIf GEOIP_CONTINENT_CODE AN Block
SetEnvIf GEOIP_CONTINENT_CODE AS Block
SetEnvIf GEOIP_CONTINENT_CODE OC Block
SetEnvIf GEOIP_COUNTRY_CODE CN Block
SetEnvIf GEOIP_COUNTRY_CODE RU Block
SetEnvIf GEOIP_COUNTRY_CODE KP Block
SetEnvIf GEOIP_COUNTRY_CODE IR Block
SetEnvIf GEOIP_COUNTRY_CODE SA Block
SetEnvIf GEOIP_COUNTRY_CODE A1 Block
BrowserMatchNoCase "Baidu" Block
BrowserMatchNoCase "Ahrefs" Block
BrowserMatchNoCase "Yandex" Block
BrowserMatchNoCase "MJ12bot" Block
BrowserMatchNoCase "MegaIndex" Block
BrowserMatchNoCase "DotBot" Block
Deny from env=Block
</IfModule>
soo29
  • 23
  • 3

1 Answers1

1

Yes, the “Deny from” code is what you want to use. You would just be able to enter the “Deny from your-server.de” line in the .htaccess file to block the entire domain, including any subdomains.

http://httpd.apache.org/docs/2.0/mod/mod_access.html#deny

Christopher H
  • 368
  • 2
  • 18
  • 1
    Note that `Deny` is an Apache 2.2 (and earlier) directive. This is _deprecated_ on Apache 2.4 - which is more likely the version the OP is using (although this has not been stated). You've also referenced the "even older" Apache 2.0 docs. – MrWhite Aug 10 '20 at 12:20