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