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