]> git.ipfire.org Git - people/shoehn/ipfire.org.git/blob - www/redirect.py
Added news for core42, fixed some tabs and corrected core41 url.
[people/shoehn/ipfire.org.git] / www / redirect.py
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",):
9 if os.environ.has_key("HTTP_ACCEPT_LANGUAGE") and \
10 os.environ["HTTP_ACCEPT_LANGUAGE"].startswith(language):
11 break
12
13 site = cgi.FieldStorage().getfirst("site") or "index"
14
15 sites = { "ipfire.org" : "http://www.ipfire.org",
16 "admin.ipfire.org" : "/%s/%s" % (language, site,),
17 "www.ipfire.org" : "/%s/%s" % (language, site,),
18 "source.ipfire.org" : "http://www.ipfire.org/%s/source" % language,
19 "tracker.ipfire.org" : "http://www.ipfire.org/%s/torrent" % language,
20 "torrent.ipfire.org" : "http://www.ipfire.org/%s/torrent" % language,
21 "download.ipfire.org" : "http://www.ipfire.org/%s/download" % language,
22 "people.ipfire.org" : "http://wiki.ipfire.org/%s/people/start" % language,
23 "pxe.ipfire.org" : "http://www.ipfire.org/%s/pxe" % language, }
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()