Skip to content

Instantly share code, notes, and snippets.

@rileyw

rileyw/404.php Secret

Created March 15, 2012 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rileyw/0afb75ef9b50d00e690d to your computer and use it in GitHub Desktop.
Save rileyw/0afb75ef9b50d00e690d to your computer and use it in GitHub Desktop.
Managing aliases and redirects
<?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";
}
?>
@rileyw
Copy link
Author

rileyw commented Mar 15, 2012

Simple redirection script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment