]>
Commit | Line | Data |
---|---|---|
2580619c MT |
1 | #!/usr/bin/python |
2 | ||
3 | import os | |
4 | import re | |
be58ffcc | 5 | import cgi |
2580619c MT |
6 | |
7 | sites = ( | |
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 |
16 | language = "en" |
17 | try: | |
18 | if re.search(re.compile("^de(.*)"), os.environ["HTTP_ACCEPT_LANGUAGE"]): | |
19 | language = "de" | |
20 | except KeyError: | |
21 | pass | |
2580619c MT |
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 |