From daaedeed7ea1f7447ac46f2b52c1249fc35608ae Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Thu, 16 Aug 2018 18:01:16 +0800 Subject: [PATCH] Update URI processing of web servers --- .htaccess | 28 +++++++++++++++---- web.config | 81 +++++++++++++++++++++++++++++++----------------------- 2 files changed, 69 insertions(+), 40 deletions(-) diff --git a/.htaccess b/.htaccess index d01bce0a..62dcb4d6 100644 --- a/.htaccess +++ b/.htaccess @@ -1,10 +1,26 @@ -RewriteEngine On + + + Options -MultiViews -Indexes + -RewriteBase / + RewriteEngine On -RewriteRule (^\.|/\.) - [F] + # You may need to uncomment the following line for some hosting environments, + # if you have installed to a subdirectory, enter the name here also. + # + # RewriteBase / -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d + # Black list protected files + RewriteRule (^\.|/\.) - [F] + RewriteRule ^storage/.* - [F] -RewriteRule ^.*$ index.php [L] + # Redirect trailing slashes if not a folder + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_URI} (.+)/$ + RewriteRule ^ %1 [L,R=301] + + # Handle front controller + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] + diff --git a/web.config b/web.config index 5ec190f5..c25037d0 100644 --- a/web.config +++ b/web.config @@ -1,34 +1,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +