Created
March 14, 2014 16:10
-
-
Save anerdev/9550845 to your computer and use it in GitHub Desktop.
Php redirect based from ip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ip = explode(".", $_SERVER['REMOTE_ADDR']); // Save in the array "ip" the octects of the ip | |
if ($ip[0] == 192) { // read the first octect, and for example, if you are from the internal lan, where the pc's ip start with "192" redirect to "index_lan.html" | |
header("location: index_lan.html"); | |
} | |
else { // if the ip doesn't start with 192, redirect to "index_wan.html" | |
header("location: index_wan.html"); | |
}; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment