Created
June 28, 2017 00:56
-
-
Save ChrisLTD/ee2783a875db16f0b247bc45af5a958e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$redirects = array( | |
"/aboutus.php" => "/about-us/", | |
"/blog/2010/02" => "/blog/", | |
"/blog/2010/04" => "/blog/", | |
"/blog/2010/07" => "/blog/", | |
"/blog/2010/12" => "/blog/", | |
"/blog/2011/01" => "/blog/", | |
); | |
// 301 Redirect from /old to /new. | |
if (array_key_exists($_SERVER['REQUEST_URI'], $redirects) && | |
// Check if Drupal or WordPress is running via command line | |
(php_sapi_name() != "cli")) { | |
header('HTTP/1.0 301 Moved Permanently'); | |
header('Location: ' . $redirects[$_SERVER['REQUEST_URI']]); | |
exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment