]> git.ipfire.org Git - people/shoehn/ipfire.org.git/blame - www/redirect.py
Add translation page.
[people/shoehn/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",):
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
13site = cgi.FieldStorage().getfirst("site") or "index"
14
7389f5ee 15sites = { "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
25httpheader = []
26
27try:
28 httpheader.append(("Location", sites[os.environ["SERVER_NAME"]]))
29except KeyError:
30 httpheader.append(("Location", sites["www.ipfire.org"]))
31
32h = HTTPResponse(302, httpheader, None)
33h.execute()