httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <jos...@slive.ca>
Subject Re: [users@httpd] block IP range with mod_rewrite
Date Tue, 17 Oct 2006 15:15:22 GMT
On 10/17/06, Norman Khine <norman@khine.net> wrote:
> hello again,
> i have the following rewrite rule,
>
> <VirtualHost *:80>
>   ServerName domain.tld
>   ServerAlias www.domain.tld
>   RewriteEngine On
>   RewriteMap    hosts-deny  txt:/home/user/apache/hosts.deny
>   RewriteCond   ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND [OR]
>   RewriteCond   ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND
>   RewriteRule   ^/.*  -  [F]
>   RewriteRule ^/(.*)
> http://udomain.tld:4080/VirtualHostBase/http/domain.tld:80/shops/shop1/VirtualHostRoot/$1
> [L,P]
>   ErrorLog /var/log/apache2/domain.tld_error.log
>   CustomLog /var/log/apache2/domain.tld_access.log combined
>   RewriteLog /var/log/apache2/domain.tld_rewrite_log
> </VirtualHost>
>
> where the
>
> RewriteMap    hosts-deny  txt:/home/user/apache/hosts.deny
>
> has the enries of the IP's I want to block from accessing my webserver.
>
> This does not work as my second RewriteRule is not taken into account.
> What is the best way to have this look at the IP address if it is in the
> list to block it, if not then the go to the next RewriteRule?
>
> When I run this the server did not respond, even though my IP was not in
> the list.
>
> Using the [F], does this mean the Rewrite Stops there and the second
> Rule is not taken into account?

What happens if you remove everything but the second RewriteRule?
Does it work then?  What is in the RewriteLog?

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message