page: override request by given script path
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 2 Oct 2017 00:12:00 +0000 (02:12 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 2 Oct 2017 00:18:42 +0000 (02:18 +0200)
Support direct requests of page.php/path for internal redirects.

.htaccess
page.php

index ef206d7f799990cb030e2a43e45211e5f0cacdd9..84f6a8d5475d8fd5d600e78ab53465bac3630fd8 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -3,4 +3,4 @@ RewriteBase    /
 
 # common php handler
 RewriteCond    %{REQUEST_FILENAME} !-f
-RewriteRule '' page.php%{REQUEST_FILENAME} [L]
+RewriteRule '' page.php [L]
index 6623c8b39c2281de2038d4dc6ae7e43df58992db..21cc0a06783982d838210aeabeadb1c1d7bb21d8 100644 (file)
--- a/page.php
+++ b/page.php
@@ -56,7 +56,7 @@ $Edit = isset($_GET['edit']);
 # distinguish subpage Args from topmost Page script
 
 $Args = '';
-$Page = preg_replace('/\?.*/', '', $_SERVER['REQUEST_URI']);
+$Page = preg_replace('/\?.*/', '', @$_SERVER['PATH_INFO'] ?: $_SERVER['REQUEST_URI']);
 $Page = urldecode(trim($Page, '/')) ?: 'index';
 while (TRUE) {
        if (file_exists("$Page/.private")) {