index: Add /de/ and /en/ versions

This commit is contained in:
2025-01-05 01:06:02 +01:00
parent 5836c63afc
commit 297f575d4b
6 changed files with 206 additions and 8 deletions

View File

@ -1,6 +1,23 @@
<?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");