Skip to content

Instantly share code, notes, and snippets.

@tboerger
Last active May 17, 2017 12:07
Show Gist options
  • Select an option

  • Save tboerger/f244c24a14b047789324fecdb6174b52 to your computer and use it in GitHub Desktop.

Select an option

Save tboerger/f244c24a14b047789324fecdb6174b52 to your computer and use it in GitHub Desktop.
diff --git a/go.php b/go.php
index e14d87db..4919520b 100644
--- a/go.php
+++ b/go.php
@@ -46,13 +46,11 @@ $mapping = array(
############# Do not edit below this line #################
-$from = $_GET['to'];
+$from = isset($_GET['to']) ? $_GET['to'] : '';
$proto = isset($_SERVER['HTTPS']) ? 'https' : 'http';
-$port = $_SERVER['SERVER_PORT'];
-$port = ($port !== '80' && $port !== '443') ? ":$port" : '';
-$name = $_SERVER['SERVER_NAME'];
+$name = $_SERVER['HTTP_HOST'];
$path = dirname($_SERVER['REQUEST_URI']);
-$location = "$proto://$name$port$path";
+$location = "$proto://$name$path";
header('HTTP/1.1 302 Moved Temporarily');
if (array_key_exists($from, $mapping)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment