]>
Commit | Line | Data |
---|---|---|
2580619c MT |
1 | #!/usr/bin/python |
2 | ||
3 | import os | |
4 | import re | |
be58ffcc | 5 | import cgi |
2580619c | 6 | |
2580619c | 7 | # Check language... |
a793fc55 MT |
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 | |
2580619c | 14 | |
8117d35b MT |
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 | ||
2580619c MT |
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]: | |
8117d35b | 36 | location += "/%s" % destination[1] |
2580619c MT |
37 | break |
38 | ||
39 | print "Location: %s" % location | |
40 | print # End the header |