Quackers Posted October 18, 2012 Posted October 18, 2012 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.
jamiess Posted October 18, 2012 Posted October 18, 2012 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"); } 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now