Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kellybell/2495197 to your computer and use it in GitHub Desktop.
Save kellybell/2495197 to your computer and use it in GitHub Desktop.
Pantheon settings.php URL normalizing code - rewrites www.sitename.com to sitename.com
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) &&
$_SERVER['PANTHEON_ENVIRONMENT'] === 'live') {
if ( $_SERVER['HTTP_HOST'] == 'live.SITENAME.gotpantheon.com' ||
$_SERVER['HTTP_HOST'] == 'www.SITENAME.com') {
header('HTTP/1.0 301 Moved Permanently');
header('Location: http://SITENAME.com'. $_SERVER['REQUEST_URI']);
exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment