From: Michael Tremer Date: Fri, 22 Aug 2008 11:32:53 +0000 (+0200) Subject: From now on, we can link all sites like: http://www.ipfire.org/downloads.shtml X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be58ffcca4604de18eceb825ab0cf5aa6b65c863;p=ipfire.org.git From now on, we can link all sites like: http://www.ipfire.org/downloads.shtml and the webserver will redirect to the right language. --- diff --git a/www/.htaccess b/www/.htaccess index 0975e2c9..9f3bb074 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -1 +1,6 @@ -DirectoryIndex index.pl index.shtml +DirectoryIndex index.py index.shtml + +RewriteEngine on +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*).shtml$ index.py?file=$1.shtml diff --git a/www/index.py b/www/index.py index 58d57366..3acfdb5d 100755 --- a/www/index.py +++ b/www/index.py @@ -2,10 +2,11 @@ import os import re +import cgi sites = ( ("ipfire.org", ("www.ipfire.org", None)), - ("www.ipfire.org", (None, "index.shtml")), + ("www.ipfire.org", (None, cgi.FieldStorage().getfirst("file") or "index.shtml")), ("source.ipfire.org", (None, "source.shtml")), ("tracker.ipfire.org", (None, "tracker.shtml")), ("download.ipfire.org", (None, "download.shtml")), @@ -18,7 +19,6 @@ try: language = "de" except KeyError: pass - print "Status: 302 Moved" print "Pragma: no-cache"