]> git.ipfire.org Git - ipfire.org.git/blob - www/redirect.py
Added pxe site.
[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["HTTP_ACCEPT_LANGUAGE"].startswith(language):
10 break
11
12 site = cgi.FieldStorage().getfirst("site") or "index"
13
14 sites = { "ipfire.org" : "http://www.ipfire.org",
15 "www.ipfire.org" : "/%s/%s" % (language, site,),
16 "source.ipfire.org" : "http://www.ipfire.org/%s/source" % language,
17 "tracker.ipfire.org" : "http://www.ipfire.org/%s/torrent" % language,
18 "torrent.ipfire.org" : "http://www.ipfire.org/%s/torrent" % language,
19 "download.ipfire.org" : "http://www.ipfire.org/%s/download" % language,
20 "people.ipfire.org" : "http://wiki.ipfire.org/%s/people/start" % language, }
21
22 httpheader = []
23
24 try:
25 httpheader.append(("Location", sites[os.environ["SERVER_NAME"]]))
26 except KeyError:
27 httpheader.append(("Location", sites["www.ipfire.org"]))
28
29 h = HTTPResponse(302, httpheader, None)
30 h.execute()