git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 06a41d45 authored by Tom Adams's avatar Tom Adams

Enable 404-based rewrites for lighttpd installations in /

parent 4e9db95b
......@@ -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.");
......
# Add this line to lighttpd.conf to enable pseudo-rewrites using 404s
server.error-handler-404 = "/index.php"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment