Forum Moderators: phranque
If I want to exclude some bad guys, is this written correctly:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REMOTE_REFERER} ^http\:\/\/www2\.example\.com\/fr\/example\/modeles\/HTML\/page\.asp.*$ [OR]
RewriteCond %{REMOTE_HOST} ^.*lavache-102-X-1-91\.w193-251\.abo\.example\.fr.*$ [NC]
RewriteRule .* [other.com...] [R,L]
Is this shortest way better:
RewriteCond %{REMOTE_REFERER} ^example\.com/fr/example/modeles/HTML/page\.asp [OR]
RewriteCond %{REMOTE_HOST} ^lavache-102-X-1-91\.w193-251\.abo\.example\.fr [NC]
[edited by: jdMorgan at 8:05 am (utc) on Mar. 4, 2004]
[edit reason] examplified URLs & IPs [/edit]
RewriteCond %{REMOTE_REFERER} ^http://www2\.example\.com/fr/example/modeles/HTML/page\.asp [OR]
RewriteCond %{REMOTE_HOST} ^.*lavache-102-X-1-91\.w193-251\.abo\.example\.fr [NC]
RewriteRule .* - [F]
Jim
I do it to keep my server error logs neat and trim. If you use 'Deny' you get an entry in the server error log reading "Client denied by server configuration," plus the usual 403 entry in your access log. If you use mod_rewrite, you get only the access log entry. I prefer to reserve my error log for serious errors -- If my error log's not empty, it means I have some 'repair' work to do.
The above behaviour may just be a result of the way my servers are configured, but it works for me. Otherwise, there's no real advantage either way. I actually use both methods for different purposes.
Jim