-
-
Save rileyw/0afb75ef9b50d00e690d to your computer and use it in GitHub Desktop.
Managing aliases and redirects
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 | |
/** | |
* Test case | |
*/ | |
// Redirection array | |
$i = array( | |
"/match/URI/" => "http://company.com/" | |
); | |
// Set destination | |
$d = $i[$_SERVER['REQUEST_URI']]; | |
if(isset($d)) { | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: ". $d); | |
} else { | |
header("HTTP/1.1 404 Not Found"); | |
print "Page not found"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple redirection script.