Skip to content

Instantly share code, notes, and snippets.

@JonTheNiceGuy
Created March 21, 2014 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonTheNiceGuy/9697299 to your computer and use it in GitHub Desktop.
Save JonTheNiceGuy/9697299 to your computer and use it in GitHub Desktop.
This script is deployed on jon.sprig.gs/redirect.php and those are linked to from /var/www/t -> /var/www/redirect.php etc.
<?php
switch($_SERVER['REQUEST_URI']) {
case '/t/':
case '/@/':
case '/twitter/':
redirect("https://twitter.com/JonTheNiceGuy");
break;
case '/fb/':
case '/facebook/':
redirect("https://www.facebook.com/JonTheNiceGuy");
break;
case '/+/':
case '/g+/':
redirect("https://plus.google.com/101307558846949684774");
break;
case '/d/':
case '/d*/':
redirect("https://joindiaspora.com/people/7f1771766a74695d");
}
function redirect($url) {
if (isset($_GET['test'])) {
echo "Redirecting to $url";
} else {
header("Location: $url");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment