Rewritemap to block list of IP Addresses
3 posts
• Page 1 of 1
- simonchalk
- Posts: 4
- Joined: 30 May 2012, 06:07
Rewritemap to block list of IP Addresses
Hi
We currently use this method to block ip addresses, but this is now getting unmanagable, since we have many ip's we want to block, so please advise if its possible to use rewriteMap to achieve the same thing and if so what rule s I would need?
RewriteCond %{REMOTE_ADDR} 192\.168\.1\.1|192\.168\.3\.1
RewriteRule (.*) $1 [F,L]
Regards,
Simon.
We currently use this method to block ip addresses, but this is now getting unmanagable, since we have many ip's we want to block, so please advise if its possible to use rewriteMap to achieve the same thing and if so what rule s I would need?
RewriteCond %{REMOTE_ADDR} 192\.168\.1\.1|192\.168\.3\.1
RewriteRule (.*) $1 [F,L]
Regards,
Simon.
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Rewritemap to block list of IP Addresses
hELLO,
please, try using the following:
and your mapfile would contain IP addresses as in following:
Regards
Andrew
please, try using the following:
- Code: Select all
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt [NC]
RewriteCond %{REMOTE_ADDR} ^(.*)$
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
RewriteRule (.*) - [F,L]
and your mapfile would contain IP addresses as in following:
- Code: Select all
192.169.0.1 192.169.0.1
192.169.0.2 192.169.0.2
192.139.50.1 192.139.50.1
Regards
Andrew
- simonchalk
- Posts: 4
- Joined: 30 May 2012, 06:07
Re: Rewritemap to block list of IP Addresses
Thanks, that works great.
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 10 guests