diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-08-05 19:01:15 +0000 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-08-05 19:01:15 +0000 |
commit | 3ebbc1c3886a67dcc83ca4f906bdd375d599e86b (patch) | |
tree | c86e6084b49cacdf84ff0eb4527d6f4aeabd3f4f /index.php | |
parent | cd71f9cc51f77b6b8e3b11c34cb7523f36339cea (diff) | |
parent | c3a522623c3a0628c33407ee01b16e189c44bba5 (diff) |
Merge branch '0.8.x' into twitter-oauth
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -107,6 +107,25 @@ 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'] != '/') { + $_lighty_path = preg_replace('/^'.preg_quote(common_config('site','path')).'\//', '', substr($_lighty_url['path'], 1)); + $_SERVER['QUERY_STRING'] = 'p='.$_lighty_path; + 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'] = $_lighty_path; + } + } + $_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."); |