Skip to content

Instantly share code, notes, and snippets.

@othree
Created January 21, 2016 07:22
Show Gist options
  • Save othree/382d62021ebb86ae0e96 to your computer and use it in GitHub Desktop.
Save othree/382d62021ebb86ae0e96 to your computer and use it in GitHub Desktop.
<?php
if ($_SERVER['HTTPS'] == on) {
$protocol = 'https';
} else {
$protocol = 'http';
}
header('Location: ' . $protocol . '://' . preg_replace('/g0b.tw$/', 'g0v.tw', $_SERVER['HTTP_HOST']) . $_GET['q'] , true, 301);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment