htaccess - SetEnvIF X-Forwarded-For


Just started building a site with C5.6 and am loving it!

There are certain IP's that have caused me problems in the past, and while I can insert the specific IP with a wildcard on the fourth range, I have found they then tend to come back via anonymous servers or use Opera Turbo.

I have read that the SetEnvIF X-Forwarded-For can be used in the htaccess file to prevent much of this, if it finds no proper IP in the header.

I have the following snippet from an Apache config file but wanted to know if this can be used in the htaccess as is?

<Directory />
SetEnvIF X-Forwarded-For "(,| |^)0\.0\.0\.0(,| |$)" DenyIP
Order allow,deny
Deny from env=DenyIP
Allow from all

View Replies: