]>
Commit | Line | Data |
---|---|---|
879aa787 MT |
1 | #!/usr/bin/python |
2 | ||
3 | import os | |
4 | import cgi | |
5 | ||
6 | from web.http import HTTPResponse | |
7 | ||
8 | for language in ("de", "en",): | |
078d0d89 MT |
9 | if os.environ.has_key("HTTP_ACCEPT_LANGUAGE") and \ |
10 | os.environ["HTTP_ACCEPT_LANGUAGE"].startswith(language): | |
879aa787 MT |
11 | break |
12 | ||
13 | site = cgi.FieldStorage().getfirst("site") or "index" | |
14 | ||
7389f5ee | 15 | sites = { "ipfire.org" : "http://www.ipfire.org", |
75720df4 | 16 | "admin.ipfire.org" : "/%s/%s" % (language, site,), |
879aa787 MT |
17 | "www.ipfire.org" : "/%s/%s" % (language, site,), |
18 | "source.ipfire.org" : "http://www.ipfire.org/%s/source" % language, | |
95145f38 MT |
19 | "tracker.ipfire.org" : "http://www.ipfire.org/%s/torrent" % language, |
20 | "torrent.ipfire.org" : "http://www.ipfire.org/%s/torrent" % language, | |
879aa787 | 21 | "download.ipfire.org" : "http://www.ipfire.org/%s/download" % language, |
75720df4 MT |
22 | "people.ipfire.org" : "http://wiki.ipfire.org/%s/people/start" % language, |
23 | "pxe.ipfire.org" : "http://www.ipfire.org/%s/pxe" % language, } | |
879aa787 MT |
24 | |
25 | httpheader = [] | |
26 | ||
27 | try: | |
28 | httpheader.append(("Location", sites[os.environ["SERVER_NAME"]])) | |
29 | except KeyError: | |
30 | httpheader.append(("Location", sites["www.ipfire.org"])) | |
31 | ||
32 | h = HTTPResponse(302, httpheader, None) | |
33 | h.execute() |