summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@controlyourself.ca>2009-08-04 15:53:15 +0000
committerSarven Capadisli <csarven@controlyourself.ca>2009-08-04 15:53:15 +0000
commitd0a020dd4ea8d58bc8230ebcde22e54ad31894a8 (patch)
treec7d14f1e09bd46c72e577ca54645a7bab4a747e7 /index.php
parent5f3af3e121a7ff06f5961bb4158e0b777ce5b5c1 (diff)
parentffa1d662a759a729151f2444bdf759749d59045e (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x
Diffstat (limited to 'index.php')
-rw-r--r--index.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/index.php b/index.php
index a73983b59..5f13064da 100644
--- a/index.php
+++ b/index.php
@@ -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.");