473,656 Members | 2,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with redirect for certain IP's

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.

Apr 9 '06 #1
2 1951
<br********@yah oo.com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.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
Apr 9 '06 #2
br********@yaho o.com 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('Locatio n: 'index2.php');
?>

</ot>
Apr 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
3232
by: Mike | last post by:
I'm used to unix/cgi scripts so im slightly out of my depth here. Ive got an asp script for a website form which works fine. What i want to do is also get the form to include the ip address of the perosn sending the form ie <input type=hidden name=env_report value=REMOTE_ADDR> Anyone know how to apply this to this asp script below?: <%
18
2459
by: | last post by:
Please help. After a number of wrong turns and experiments I need advice on login management system to secure our web pages without inconveniencing our visitors or our internal staff. What I need: A system whereby the user only has to register ONCE and he will have automatic entry to ANY page without havinto to RE-LOGIN even if he comes in
6
4553
by: \A_Michigan_User\ | last post by:
Ok, I give up... why do 1-4 work fine... but 5-6 give "can't find" errors? 1. Client-side VBscript code: call navigate("\\209.11.22.33\MyDir") 2. Client-side VBscript code: location.href ="\\209.11.22.33\MyDir" 3. Typing "\\209.11.22.33\MyDir" into my ie6 browser. 4. Typing "\\209.11.22.33\MyDir" into my Windows Explorer. 5. Server-side ASP: server.transfer "\\209.11.22.33\MyDir" 6. Server-side ASP: response.redirect...
1
1895
by: jonathanthio | last post by:
Do anyone knows how to redirect based on IP? Things like if (user.ip=202.23.23.4){ window.location="go here" }
8
5462
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
1
2738
by: MikeM | last post by:
We are getting a behavior on a Response.Redirect("SomeUrl", True) that I'm hoping someone can explain. This all refers to the code snip at the end. By the way, this is all VB ASP.NET v1.0 code. So we have the Page_Load event of an ASPX page fire which in the snip you see calls "SomeMethod". Also you see in Page_Load two Catch statements. The first is "SpecialException". We created our own extended exception (inherits from...
19
13090
by: IveCal | last post by:
Hello, I have this code which redirects to http://www.domain.com/link.html . . . but I want to specify the NUMBER OF SECONDS before the site is redirected. Can somebody here help me . . .. <meta http-equiv="Refresh" content="4;url=http://www.domain.com/link.html"> PLEASE HELP. Thanks.
12
1606
by: smerf | last post by:
I have searched high and low (and even in some places I'd like to forget I ever saw) for the information that will tell me exactly how the Nat2Nat server for UltraVNC works (not just a vague diagram, but the code needed - at least psuedocode - to connect the 2 clients) . (You can see it at http://www.uvnc.com/addons/nat2nat.html.) I get the diagram and all, but how exactly would you get 2 UDP connections to your UDP server to start...
1
3560
by: Trev | last post by:
Hi everyone, I'm trying to modify an existing piece of Javascript that will enable a redirect to a page based on IP address and/or keywords in the referrer; for instance, redirecting an existing member to a page that bypasses introductory blurb etc. I've included the code in an shtml file to allow server side includes. I've included the code below, but it doesn't work- it falls over at the
0
8382
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8717
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7311
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.