]> git.ipfire.org Git - ipfire.org.git/blame - www/index.py
Added news about beta 5.
[ipfire.org.git] / www / index.py
CommitLineData
2580619c
MT
1#!/usr/bin/python
2
3import os
4import re
be58ffcc 5import cgi
2580619c
MT
6
7sites = (
8 ("ipfire.org", ("www.ipfire.org", None)),
be58ffcc 9 ("www.ipfire.org", (None, cgi.FieldStorage().getfirst("file") or "index.shtml")),
2580619c
MT
10 ("source.ipfire.org", (None, "source.shtml")),
11 ("tracker.ipfire.org", (None, "tracker.shtml")),
12 ("download.ipfire.org", (None, "download.shtml")),
13 )
14
15# Check language...
a793fc55
MT
16language = "en"
17try:
18 if re.search(re.compile("^de(.*)"), os.environ["HTTP_ACCEPT_LANGUAGE"]):
19 language = "de"
20except KeyError:
21 pass
2580619c
MT
22
23print "Status: 302 Moved"
24print "Pragma: no-cache"
25
26location = ""
27
28for (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
36print "Location: %s" % location
37print # End the header