On Fri, 7 Jun 2002, Andy Gardner wrote:
At 5:16 PM +1200 6/7/02, Jean-Francois Pirus wrote:
used in New Zealand. My ultimate goal is to check users visiting a website to see if they are connected to the internet within New Zealand and redirect them to different pages accordingly, much like Google seems to be able to do these days, ie when I enter www.google.com, I end up at www.google.co.nz, and I'm assuming that this is done based on the IP address of the machine I'm on...??..
The way most people do it is by doing a reverse-dns lookup on the ip address of the client and looking for .nz at the end (for example) it will work most of the time.
I have a php script that does that if you are interested.
If you're using Apache, you can do it easily (and much faster) with mod_rewrite (usually within your <virtualhost> container)...
RewriteEngine On RewriteLogLevel 0 RewriteCond %{REMOTE_HOST} .*nz$ RewriteRule ^/index.html$ /indexnz.html [L]
Assuming "HostnameLookups On" which will add [per client] initial connection overhead which is usually undesirable in high load scenarios. Messy. Matt. - To unsubscribe from nznog, send email to majordomo(a)list.waikato.ac.nz where the body of your message reads: unsubscribe nznog