From 46ef151966b5b7316976ae63cc2c8ed58618ffcf Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Fri, 30 Jul 2010 14:23:14 -0400 Subject: [PATCH] Add a browsing prefix for rewrite rules (#8524) --- chora/.htaccess | 2 ++ chora/lib/Chora.php | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/chora/.htaccess b/chora/.htaccess index b49e18dbb..dc66fa7eb 100644 --- a/chora/.htaccess +++ b/chora/.htaccess @@ -1,7 +1,9 @@ +Allow from all RewriteEngine On RewriteRule ^([a-z]+).php/(.*)$ $1.php?f=$2 [QSA,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^browse/(.*)$ browsedir.php?f=$1 [QSA] RewriteRule ^(.*)$ browsedir.php?f=$1 [QSA] diff --git a/chora/lib/Chora.php b/chora/lib/Chora.php index aaa72d850..fb0ef02c4 100644 --- a/chora/lib/Chora.php +++ b/chora/lib/Chora.php @@ -113,9 +113,10 @@ class Chora if ($GLOBALS['conf']['options']['urls'] == 'rewrite') { if (in_array($script, array('browse.php', 'browsedir.php'))) { - $script = $uri; - if (substr($script, 0, 1) == '/') { - $script = substr($script, 1); + if (substr($uri, 0, 1) == '/') { + $script = "browse$uri"; + } else { + $script = "browse/$uri"; } } else { $script .= '/' . $uri; -- 2.11.0