From: Jakub Bouček Date: Tue, 22 Sep 2020 23:22:03 +0000 (+0200) Subject: Fixed canonical redirects on non-root url app instances X-Git-Tag: v0.30.2~1^2~4^2 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/1e88e8086f9db19ae7782b12f06e9c47dd772240 Fixed canonical redirects on non-root url app instances If BookStack instance is deployed to any non-root path, e.g. http://example.com/wiki/, requests for http://example.com/wiki/shelves/ was redirected to http://example.com/shelves instead of http://example.com/wiki/shelves Synced with: https://github.com/laravel/laravel/blob/master/public/.htaccess --- diff --git a/public/.htaccess b/public/.htaccess index abe87b39d..3aec5e27e 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -11,9 +11,10 @@ # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^(.*)/$ /$1 [L,R=301] + RewriteCond %{REQUEST_URI} (.+)/$ + RewriteRule ^ %1 [L,R=301] - # Handle Front Controller... + # Send Requests To Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L]