Skip to content

Instantly share code, notes, and snippets.

@RickyPughcardo
Created December 12, 2013 23:45
Show Gist options
  • Save RickyPughcardo/7937651 to your computer and use it in GitHub Desktop.
Save RickyPughcardo/7937651 to your computer and use it in GitHub Desktop.
// Redirect to force indexing with custom domain sitemap
$subject = $_SERVER['HTTP_HOST'];
$pattern = '/gotpantheon.com/sitemap.xml$/';
preg_match($pattern, $subject, $matches);
$counted = count($matches);
if ($counted > 0 ) {
header('HTTP/1.0 301 Moved Permanently');
header('Location: http://yoursite.com/sitemap.xml'. $_SERVER['REQUEST_URI']);
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment