You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sa...@seagate.com on 2002/11/13 00:07:20 UTC

[users@httpd] redirection based on client IP address (only first two octets)

Hi All,
I have the following REWRITE rules to redirect based upon client IP
address. The redirection works fine. However now I want to redirect based
on only first 2 octets of the IP address. e.g:

10.4.*.* should be redirected to dilbert.com
10.26.*.* should be redirected to ccc.de
10.5 should be redirected cnn.de
 so on and so forth.

I am not able to figure out how to do this. Can anyone help me out here.
Thanks

====================================
file: httpd.conf
RewriteMap  redirector txt:/tmp/redirector.map
RewriteCond ${redirector:%{REMOTE_ADDR}|NO-REDIRECT} !=NO-REDIRECT
RewriteRule ^.* ${redirector:%{REMOTE_ADDR}} [R,L]

^^^^^^^^^^^^^^^
file: redirector.map
[root@xml saqib]# vi /tmp/redirector.map
##
##  redirector.map
##

10.26.6.252   http://www.ccc.de
10.4.6.2     http://www.dilbert.com
....          ...
=======================================

Thanks
Saqib Ali


---------------------------------------------------------------------
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