Forum Moderators: phranque
deny from googleusercontent.com amazonaws.com
deny from 68.183.245.101 62.149.225.67
If you use a host name in a Deny rule in the .htaccess, Apache will convert your Apache log into host names instead of IP addresses.
"I have the entire /8 set to bad_range"I use mod_setenvif in conjunction with mod_auth-I-forget. That is, first the environmental variables are set, and then those are used for access control. In the specific case of IP ranges, it looks like this.
Please can you give me your code/syntax for blocking 20?
Require ip 20 Require ip 20.0.0.0/8
RewriteCond %{REQUEST_FILENAME} ^robots\.txt$
RewriteRule ^(.*)$ - [END]
deny from 123.123.123.123..etc
RewriteCond %{HTTP_USER_AGENT} ^.*(DataForSeoBot|AhrefsBot|wp_is_mobile|AppleBot|meerkatseo|LWP|AppleNewsBot|yacy|infotiger|amazonbot|YisouSpider).*$ [NC]
RewriteRule .* - [F,L] [edited by: Brett_Tabke at 2:06 pm (utc) on Jul 25, 2022]
ErrorDocument 403 /403.php (or whatever the name of the 403 file is) If you have the ip denied elsewhere in the htaccess file.As noted elsewhere, each module is an island. Actions taken in mod_authz_core * cannot be overriden with mod_rewrite, and vice versa.
RewriteCond %{REQUEST_FILENAME} ^robots\.txt$
RewriteRule ^(.*)$ - [END]just makes extra work for the server. Anything that can go in the body of a RewriteRule, should go in the body of a RewriteRule. Here it would be simply RewriteRule ^robots.txt - [END]