Files
elwig-www/www/index.php

45 lines
1.4 KiB
PHP

<?php
header("Content-Length: 0");
switch ($_SERVER['PATH_INFO']) {
case '':
case '/':
$lang = 'de'; // prefer german
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $pref) {
$l = substr($pref, 0, 2);
if ($l === 'de') {
$lang = 'de';
break; // force german
} else if ($l === 'en') {
$lang = 'en'; // use english only, if user specifically asks for it
}
}
}
header("Status: 303");
header("Location: /$lang/");
break;
case '/changelog':
header("Status: 303");
header("Location: https://git.necronda.net/winzer/elwig/src/branch/main/CHANGELOG.md#changelog");
break;
case '/vcs':
case '/git':
case '/src':
case '/source':
case '/code':
header("Status: 303");
header("Location: https://git.necronda.net/winzer/");
break;
case '/access':
header("Status: 303");
header("Location: https://access.elwig.at/");
break;
default:
if (str_starts_with($_SERVER['PATH_INFO'], '/access/')) {
header("Status: 308");
header("Location: https://access.elwig.at/" . substr($_SERVER['PATH_INFO'], 8));
} else {
header("Status: 404");
}
}