+ Post New Thread
Results 1 to 2 of 2
Web Development Thread, Redirect based on client IP. in Coding and Web Development; Anybody able to knock me up a small re-direct script based on IP? All our Staff Laptops are in the ...
  1. #1
    Quackers's Avatar
    Join Date
    Jan 2006
    Posts
    1,310
    Thank Post
    40
    Thanked 141 Times in 116 Posts
    Rep Power
    53

    Redirect based on client IP.

    Anybody able to knock me up a small re-direct script based on IP?

    All our Staff Laptops are in the 192.168.6.x range. Want to set their homepage to a page that checks what their client IP is and if it matches 192.168.6.* redirect to one URL but if its any other IP redirect to another URL.

  2. #2
    jamiess's Avatar
    Join Date
    Oct 2009
    Location
    Balsall Common
    Posts
    72
    Thank Post
    10
    Thanked 20 Times in 17 Posts
    Rep Power
    14
    Hi,

    You can do this in php

    PHP Code:
    $ip '192.168.6.;

    if (substr($_SERVER['
    REMOTE_ADDR'], 0, strlen($ip)) === $ip) {
        header("Location:http://www.google.com");
    }
    else{
        header("Location:http://www.google.com");


  3. Thanks to jamiess from:

    Quackers (18th October 2012)

SHARE:
+ Post New Thread

Similar Threads

  1. Adding new printers based on IP Address
    By joe_Burge in forum Scripts
    Replies: 0
    Last Post: 22nd August 2011, 09:14 PM
  2. redirect a user based on the OU Sharepoint
    By mtdmitchell in forum Virtual Learning Platforms
    Replies: 11
    Last Post: 27th March 2010, 09:06 AM
  3. Assinging printers to clients based on OU
    By originofsymmetry in forum Network and Classroom Management
    Replies: 3
    Last Post: 11th July 2007, 06:02 AM
  4. Redirected desktop based on machine
    By Jobos in forum Windows
    Replies: 8
    Last Post: 15th June 2007, 11:18 AM
  5. Setting Printers Based On Room Location
    By ICTNUT in forum Scripts
    Replies: 34
    Last Post: 13th May 2006, 08:19 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •