Jump to content

Recommended Posts

Posted

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.

Posted

Hi,

 

You can do this in php

 

$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");
}

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...