I have a collectively very long list of black listed IPs (for different reasons). Something like this (just an example):
SetEnvIF X-Forwarded-For "1.2.100.*" DenyIP
SetEnvIF X-Forwarded-For "2.3.4.*" DenyIP
SetEnvIF X-Forwarded-For "123.123.*.*" DenyIP
..
..
..
..
..
SetEnvIF X-Forwarded-For "200.200.*.*" DenyIP
Order Deny,Allow
Deny from env=DenyIP
It is working, but about 200 lines long.
Question
How do I put all these lines (SetEnvIF X-Forwarded-For "<ip>" DenyIP
) inside a TXT file, and then load it inside .htaccess
so that I could do the same Deny from env=DenyIP
again, please?
Note: For some reasons, I need it for the .htaccess
approach. Not able to put inside VirtualHost Config settings.
Thank you all in advance.
You can't do this on
.htaccess
. TheInclude
directive only works in server config, virtual host and directory contexts. You either have it directly in.htaccess
or include it in the<Directory>
block.