]> BookStack Code Mirror - bookstack/commitdiff
Fixed canonical redirects on non-root url app instances 2272/head
authorJakub Bouček <redacted>
Tue, 22 Sep 2020 23:22:03 +0000 (01:22 +0200)
committerJakub Bouček <redacted>
Sun, 27 Sep 2020 00:50:37 +0000 (02:50 +0200)
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

public/.htaccess

index abe87b39de7a73abd817cedd264d3c1f7b9ec17b..3aec5e27e5db801fa9e321c0a97acbb49e10908f 100644 (file)
 
     # 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]