diff options
author | Tom Adams <tom@holizz.com> | 2009-07-30 19:19:12 +0100 |
---|---|---|
committer | Tom Adams <tom@holizz.com> | 2009-08-04 01:24:28 +0100 |
commit | 06a41d4516182fb141ce9171ea79a52257c45e8b (patch) | |
tree | 065821fbfe05bf90e316ac41cde9c5407ac5936e /index.php | |
parent | 4e9db95bcfe7818f4f937f3e29f31ea64cd73330 (diff) |
Enable 404-based rewrites for lighttpd installations in /
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -107,6 +107,24 @@ function checkMirror($action_obj) function main() { + // fake HTTP redirects using lighttpd's 404 redirects + if (strpos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') !== false) { + $_lighty_url = $base_url.$_SERVER['REQUEST_URI']; + $_lighty_url = @parse_url($_lighty_url); + + if ($_lighty_url['path'] != '/index.php' && $_lighty_url['path'] != '/') { + $_SERVER['QUERY_STRING'] = 'p='.substr($_lighty_url['path'], 1); + if ($_lighty_url['query']) + $_SERVER['QUERY_STRING'] .= '&'.$_lighty_url['query']; + parse_str($_lighty_url['query'], $_lighty_query); + foreach ($_lighty_query as $key => $val) { + $_GET[$key] = $_REQUEST[$key] = $val; + } + $_GET['p'] = $_REQUEST['p'] = substr($_lighty_url['path'], 1); + } + } + $_SERVER['REDIRECT_URL'] = preg_replace("/\?.+$/", "", $_SERVER['REQUEST_URI']); + // quick check for fancy URL auto-detection support in installer. if (isset($_SERVER['REDIRECT_URL']) && (preg_replace("/^\/$/","",(dirname($_SERVER['REQUEST_URI']))) . '/check-fancy') === $_SERVER['REDIRECT_URL']) { die("Fancy URL support detection succeeded. We suggest you enable this to get fancy (pretty) URLs."); |