Skip to content

Instantly share code, notes, and snippets.

@avantegarde
Last active February 23, 2016 20:41
Show Gist options
  • Save avantegarde/2f682c7da66c1c756590 to your computer and use it in GitHub Desktop.
Save avantegarde/2f682c7da66c1c756590 to your computer and use it in GitHub Desktop.
Redirect and match ALL urls to new domain
<?php
// Redirect ALL urls to another domain
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) &&
($_SERVER['PANTHEON_ENVIRONMENT'] === 'live') &&
(php_sapi_name() != "cli")) {
$newurl = 'http://www.jfrohrbaugh.com/'. $_SERVER['REQUEST_URI'];
header('HTTP/1.0 301 Moved Permanently');
header("Location: $newurl");
exit();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment