aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-07-06 16:55:20 +0000
committerRomain d'Alverny <rda@mageia.org>2011-07-06 16:55:20 +0000
commit1a0f7746667c91bb81ef8c0c391943ff8bc8781a (patch)
tree26f8ac04b4d997ae3e105b68971cf4234ae8e066 /index.php
parent629f4e8a6d122cffc3eb9a1ac2f5d02d29d66170 (diff)
downloadwww-1a0f7746667c91bb81ef8c0c391943ff8bc8781a.tar
www-1a0f7746667c91bb81ef8c0c391943ff8bc8781a.tar.gz
www-1a0f7746667c91bb81ef8c0c391943ff8bc8781a.tar.bz2
www-1a0f7746667c91bb81ef8c0c391943ff8bc8781a.tar.xz
www-1a0f7746667c91bb81ef8c0c391943ff8bc8781a.zip
catch /?fromtld=$tld requests: new tld_redirect()
Diffstat (limited to 'index.php')
-rw-r--r--index.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/index.php b/index.php
index 2d86636d6..750ce878d 100644
--- a/index.php
+++ b/index.php
@@ -7,17 +7,27 @@ require_once 'langs.inc.php';
// NOTE, this should go to the main controller in the next platform
// (catching all requests)
-$domain = 'mageia.org';
+$domain = 'mageia.org';
$www_domain = 'www.' . $domain;
+
if (G_VHOST == $domain) {
+ // rewrite "//mageia.org/" to "//www.mageia.org/"
header ('HTTP/1.1 301 Moved Permanently');
header(sprintf('Location: http://%s%s', $www_domain, $_SERVER['REQUEST_URI']));
die;
-} elseif (G_VHOST != $www_domain) {
+}
+elseif (isset($_GET['fromtld'])) {
+ // rewrite "//mageia.org/?fromtld=it" to "//www.mageia.org/it/"
+ tld_redirect($_GET['fromtld'], $domains_lang, $www_domain);
+}
+elseif (G_VHOST != $www_domain) {
+ // rewrite "//mageia.it/" to "//www.mageia.org/it/"
domain_redirect($_SERVER['SERVER_NAME'], $domains_lang, $www_domain);
}
-if (isset($_GET['langs'])) { die(show_langs($langs)); }
+if (isset($_GET['langs'])) {
+ die(show_langs($langs));
+}
if (isset($_GET['flang']))
{