Reputation: 11082
I have problems with spam from servers with the domain .kimsufi.com
and .SteepHost.Net
. I used to block them using the following htaccess-command:
Deny from .SteepHost.Net
Deny from .kimsufi.com
Instead of blocking requests, I'd like to redirect them to a static page (e.g. "access.html" saying "please contact the admin,...") For IP-addresses this works with the following commands:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} ###.###.75.51
RewriteRule ^(.*)$ access.html
But how can I use the users' host instead of the IP-address? I tried for example:
RewriteCond %{REMOTE_HOST} ^(.*)\.kimsufi\.com$ [NC,OR]
RewriteCond %{REMOTE_HOST} ^(.*)\.SteepHost\.Net$ [NC]
But it did not work,...
Upvotes: 1
Views: 439
Reputation: 4010
Try to replace %{REMOTE_ADDR} by %{REMOTE_HOST}. But it implies to set HostnameLookups to On (or Double), which can slow down your site.
Upvotes: 1
Reputation: 2453
Just use REMOTE_HOST instead of REMOTE_ADDR.
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} ^.+\.EvilDomain\.com$
RewriteRule ^(.*)$ access.html
See: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
Upvotes: 1