]> git.ipfire.org Git - ipfire.org.git/blob - www/index.py
Redirect http://people.ipfire.org/.
[ipfire.org.git] / www / index.py
1 #!/usr/bin/python
2
3 import os
4 import re
5 import cgi
6
7 # Check language...
8 language = "en"
9 try:
10 if re.search(re.compile("^de(.*)"), os.environ["HTTP_ACCEPT_LANGUAGE"]):
11 language = "de"
12 except KeyError:
13 pass
14
15 index = cgi.FieldStorage().getfirst("file") or "index"
16
17 sites = (
18 ("ipfire.org", ("www.ipfire.org", None)),
19 ("www.ipfire.org", (None, index + "/%s" % language)),
20 ("source.ipfire.org", ("www.ipfire.org", "source/" + language)),
21 ("tracker.ipfire.org", ("www.ipfire.org", "tracker/" + language)),
22 ("download.ipfire.org", ("www.ipfire.org", "download/" + language)),
23 ("people.ipfire.org", ("wiki.ipfire.org", language + "/people/start")),
24 )
25
26 print "Status: 302 Moved"
27 print "Pragma: no-cache"
28
29 location = ""
30
31 for (servername, destination) in sites:
32 if servername == os.environ["SERVER_NAME"]:
33 if destination[0]:
34 location = "http://%s" % destination[0]
35 if destination[1]:
36 location += "/%s" % destination[1]
37 break
38
39 print "Location: %s" % location
40 print # End the header