httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saqib.N....@seagate.com
Subject [users@httpd] redirection based on client IP address (only first two octets)
Date Mon, 18 Nov 2002 16:09:24 GMT
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


Mime
View raw message