如何阻止RewriteRule删除尾部斜杠


How to stop RewriteRule from removing trailing slash

我的"fs"文件夹中的.htaccess文件中有以下内容:

RewriteEngine on
RewriteRule ^(.*)$ index.php [L]

基本上,我希望所有的url都发送到index.php文件,但我需要在url中保留尾部斜杠。RewriteRule似乎总是从url中删除尾部斜杠,我需要保留它们。

http://example.com/fs/path/被重定向到http://example.com/fs/path

如何防止删除尾部斜线?我需要保留尾部斜线。你知道我该怎么做吗?

编辑这是家长。htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^auth(.*)$ auth.php?$1 [L]
RewriteRule ^file/(.*)$ file.php?path=/$1 [L]
RewriteRule ^(.*).css$ css.php?path=/$1 [NC]
<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file '.(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

让你的/fs/.htaccess像这样:

RewriteEngine on
RewriteBase /fs/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]