/data/sites/web/belgiumgtrstorecom/www/lang.php
<?php
$known_langs = array('nl','en');
$user_pref_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach($user_pref_langs as $idx => $lang) {
$lang = substr($lang, 0, 2);
if (in_array($lang, $known_langs)) {
switch ($lang) {
case 'nl':
header('location: /NL');
die();
break;
case 'en':
header('location: /EN');
die();
break;
}
} else {
header('location: /EN');
die();
}
}
/data/sites/web/belgiumgtrstorecom/www/lang.php
<?php
$known_langs = array('nl','en');
$user_pref_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach($user_pref_langs as $idx => $lang) {
$lang = substr($lang, 0, 2);
if (in_array($lang, $known_langs)) {
switch ($lang) {
case 'nl':
header('location: /NL');
die();
break;
case 'en':
header('location: /EN');
die();
break;
}
} else {
header('location: /EN');
die();
}
}
/data/sites/web/belgiumgtrstorecom/www/index.php
$router->map('GET','/EN/liberty-walk', 'content/EN/libertywalk-file.php', 'liberty-walk-EN');
$router->map('GET','/EN/events', 'content/EN/events-file.php', 'events-EN');
$router->map('GET','/EN/services', 'content/EN/services-file.php', 'services-EN');
$router->map('GET','/EN/services/', 'content/EN/services-file.php', 'services-EN-trailing');
$router->map('GET','/EN/services/[*:action]', 'content/EN/services-file.php', 'services-specific-EN');
$router->map('GET','/EN/contact', 'content/EN/contact-file.php', 'contact-EN');
$router->map('GET','/EN/forsale', 'content/EN/forsale-file.php', 'forsale-EN');
$router->map('GET','/EN/merchandise', 'content/EN/merchandise-file.php', 'merchandise-EN');
$router->map('GET','/EN/termsofuse', 'content/EN/termsofuse.php', 'termsofuse-EN');
$router->map('GET','/EN/privacypolicy', 'content/EN/privacypolicy.php', 'privacypolicy-EN');
$router->map('GET', '*', '404.php', '404');
$match = $router->match();
// call closure or throw 404 status
if( $match && is_callable( $match['target'] ) ) {
call_user_func_array( $match['target'], $match['params'] );
} elseif($match) {
require $match['target'];
}else {
header( $_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
exit(); // terminate the script
}