prefer get parameter for apache redirects
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 27 Jun 2019 15:14:23 +0000 (17:14 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 24 Jul 2019 02:11:38 +0000 (04:11 +0200)
Switching to Apache2's event MPM broke rewrites with path info.

.htaccess
widget.php

index bacadc7435ad759a8b3f598376bffb4b8d03b09e..f28aa3cd195074cde1f0c8dce257ca549573deb5 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -2,4 +2,4 @@ AddHandler application/x-httpd-php php
 
 RewriteEngine  on
 RewriteCond    %{REQUEST_FILENAME}.php -f
-RewriteRule    ^([^/]+)(.*)  $1.php$2
+RewriteRule    ^([^/]+)(.*)  $1.php?clan=$2
index 463ff67f1fef13c14182736797e4aa493c1a99fe..c99611140d654aca1a66b0add7a697e63d0c7a9b 100644 (file)
@@ -17,7 +17,7 @@ function error($message, $status = 500)
        exit;
 }
 
-$request = trim($_SERVER['PATH_INFO'], '/');
+$request = trim($_GET['clan'] ?? $_SERVER['PATH_INFO'], '/');
 $target = "data/$request.json";
 $last = file_exists($target) ? lstat($target)['mtime'] : 0;