Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Help with redirect for certain IP's

Reply
Thread Tools

Help with redirect for certain IP's

 
 
bryant_j_j@yahoo.com
Guest
Posts: n/a
 
      04-09-2006
Hi everyone,

Does anybody know how to redirect every visitor to a webpage, except
those coming from some specified IP addresses, to a different webpage?
Does anybody know of a JavaScript for this or how to do it?

For example, I want everyone who visits www.someaddress.org/myhomepage
to be redirected to www.someaddress.org/myhomepage /index2.html, except
for certain visitors with IP addresses A1.B1.C1.D1, A2.B2.C2.D2, ...
or from a range of IP addresses such as A1.B1.C1.XXX, where XXX is any
3 digits (I do not want these guys to be re-directed) ...

TIA, J.

 
Reply With Quote
 
 
 
 
Aaron Gray
Guest
Posts: n/a
 
      04-09-2006
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Hi everyone,
>
> Does anybody know how to redirect every visitor to a webpage, except
> those coming from some specified IP addresses, to a different webpage?
> Does anybody know of a JavaScript for this or how to do it?
>
> For example, I want everyone who visits www.someaddress.org/myhomepage
> to be redirected to www.someaddress.org/myhomepage /index2.html, except
> for certain visitors with IP addresses A1.B1.C1.D1, A2.B2.C2.D2, ...
> or from a range of IP addresses such as A1.B1.C1.XXX, where XXX is any
> 3 digits (I do not want these guys to be re-directed) ...
>
> TIA, J.


Best to do that server side, not sure if it can be done client side.

Aaron


 
Reply With Quote
 
 
 
 
Roman Ziak
Guest
Posts: n/a
 
      04-10-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi everyone,
>
> Does anybody know how to redirect every visitor to a webpage, except
> those coming from some specified IP addresses, to a different webpage?
> Does anybody know of a JavaScript for this or how to do it?
>
> For example, I want everyone who visits www.someaddress.org/myhomepage
> to be redirected to www.someaddress.org/myhomepage /index2.html, except
> for certain visitors with IP addresses A1.B1.C1.D1, A2.B2.C2.D2, ...
> or from a range of IP addresses such as A1.B1.C1.XXX, where XXX is any
> 3 digits (I do not want these guys to be re-directed) ...
>
> TIA, J.
>


Do a HTTP request to http://www.whatismyip.org/ and based on the result
assign window.location.

However, more elegant would be server-side, which will work regardless
on client javascript enabled or not

<ot>

<?php
if($_SERVER['REMOTE_ADDR'] == '127.0.0.1')
header('Location: 'index2.php');
?>

</ot>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Vista cannot obtain an IP address from certain routers or from certain non-Microsoft DHCP Brian W Wireless Networking 7 01-31-2010 03:46 AM
Binding certain rows to certain columns in GridView? bernard.oflynn@gmail.com ASP .Net 2 03-25-2008 03:49 PM
Finding one certain line in a file is easy but how to look forheadlines and something just under this certain headline? kazaam Ruby 3 08-26-2007 03:34 PM
Expanding certain path to certain node in a JTree arun.hallan@gmail.com Java 0 01-08-2005 08:26 PM
Basic Q - Response.Redirect, all redirect to first Response.Redirect statement Sal ASP .Net Web Controls 1 05-15-2004 03:46 PM



Advertisments