Forum Moderators: phranque

Message Too Old, No Replies

Need help using SetEnvIf and Deny from

or is there another way to block .ht* files

         

nancyb

1:07 pm on Sep 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain\.com
RewriteRule ^(.*) [mydomain.com...] [R=permanent,L]
#ErrorDocument 401 /err401.htm
ErrorDocument 403 /err403.htm
ErrorDocument 404 /err404.htm
SetEnvIf Request_URI \.htaccess$ ban
SetEnvIf Request_URI \.htpasswd$ ban
#
#ebay copier 060810
Deny from 24.28.241.xx
Deny from 64.15.#*$!.0
Deny from 125.xx.0.0/16
Deny from 165.xx
Deny from 193.40.x
Deny from 193.51.xx
Deny from 193.#*$!.0.0/19
<Files *>
Order Allow,Deny
Allow from all
</Files>

followed by rewrite conditions and redirects...

How do I set a variable for the SetEnvIf requests and still use Deny from without a variable or do I need to put a ban on the end of every Deny from line?

I've been reading, but everything I try either results in a 500 or no block of the IP.

nancyb

1:55 pm on Sep 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



too late to edit ...

I want to use DENY FROM so I can use CIDR/Netmasks.

<another edit>

think I figured it out, no more 500s with this:
SetEnvIf Request_URI \.htaccess$ ban
SetEnvIf Request_URI \.htpasswd$ ban
<Files *>
Order Allow,Deny
Deny from 24.28.241.xx
Deny from 64.15.xx.0
Deny from 125.xx.0.0/16
Deny from 165.xx
Deny from 193.40.x
Deny from 193.51.xx
Deny from 193.xx.0/19
Allow from all
Deny from env=ban
</Files>