我的“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>
答案 0 :(得分:0)
让/fs/.htaccess
像这样:
RewriteEngine on
RewriteBase /fs/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]