Skip to content

Instantly share code, notes, and snippets.

@werty1st
Last active December 1, 2015 13:54
Show Gist options
  • Save werty1st/632650cc6d0219d534b5 to your computer and use it in GitHub Desktop.
Save werty1st/632650cc6d0219d534b5 to your computer and use it in GitHub Desktop.
php forward subdomain zu url
<?php
$subdomain = array_shift((explode(".",$_SERVER['HTTP_HOST'])));
$urlmap = [
"spiel1" => "http://quiz.tivi.de/quiz/1057-toleranz-und-respekt/",
"spiel2" => "http://quartett.tivi.de/krasse-kolosse/",
"spiel3" => "http://fehlersuche.spiel.tivi.de/game/E2123874",
"spiel4" => "http://fehlersuche.spiel.tivi.de/game/A66FAF75",
];
/*
#testserver
php -S 127.0.0.1:7171 -t .
#test:
wget -q -O- --header="Host: spiel1.tivi.de" http://127.0.0.1:7171
curl --noproxy "*" -H "Host: spiel1.tivi.de" http://127.0.0.1:7171
*/
?>
<!-- Alternative1 -->
<!--
<html>
<meta http-equiv="refresh" content="1; URL=<?php echo $urlmap[$subdomain]; ?>">
<body>
Du wirst sofort zu deinem Spiel weitergeleitet.
</body>
</html>
-->
<!-- Alternative2 -->
<html>
<body style="margin: 0px;">
<iframe src="<?php echo $urlmap[$subdomain]; ?>" height="100%" width="100%"
marginwidth="0" marginheight="0" align="top" scrolling="No" frameborder="0" hspace="0" vspace="0"></iframe>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment