]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
lighttpd rewrites now possible in other directories.
authorTom Adams <tom@holizz.com>
Thu, 30 Jul 2009 19:55:33 +0000 (20:55 +0100)
committerTom Adams <tom@holizz.com>
Tue, 4 Aug 2009 00:24:30 +0000 (01:24 +0100)
index.php

index c6776b11bbc7dff46941d57188649e90662cfce0..5f13064dabe8b070547d147c537c243821c92f98 100644 (file)
--- a/index.php
+++ b/index.php
@@ -113,14 +113,15 @@ function main()
         $_lighty_url = @parse_url($_lighty_url);
 
         if ($_lighty_url['path'] != '/index.php' && $_lighty_url['path'] != '/') {
-            $_SERVER['QUERY_STRING'] = 'p='.substr($_lighty_url['path'], 1);
+            $_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'] = substr($_lighty_url['path'], 1);
+            $_GET['p'] = $_REQUEST['p'] = $_lighty_path;
         }
     }
     $_SERVER['REDIRECT_URL'] = preg_replace("/\?.+$/", "", $_SERVER['REQUEST_URI']);