这与我之前的问题有关(可以查看here)。我希望能够删除 URL 中的尾部斜杠,这样它就不会弄乱我网站的某些区域。 .htaccess 代码在这里:
# -s = File Exists
RewriteCond %{REQUEST_FILENAME} -s [OR]
# -l = Is a SymLink
RewriteCond %{REQUEST_FILENAME} -l [OR]
# -d = Is a Directory
RewriteCond %{REQUEST_FILENAME} -d
# if we match any of the above conditions - serve the file.
RewriteRule ^.*$ - [NC,L]
# only allows '.' in the "page" portion.
RewriteRule ^([^/.]+)/?$ index.php?section=$1 [L]
RewriteRule ^([^/.]+)/([^/]+)/?$ index.php?section=$1&page=$2 [L]
RewriteRule ^([^/.]+)/([^/]+)/([^/.]+)/?$ index.php?section=$1&page=$2&split=$3 [L]
和以前一样,我对此一无所知,所以有人可以帮忙吗?
我假设您正在谈论规则:
RewriteRule ^.*$ - [NC,L]
因为另一个已经省略了尾部斜杠。
试试这个:
RewriteRule ^(.*)/$ $1 [NC,L]
这是我在日志中看到的内容(缩写):
applying pattern '^(.*)/$' to uri 'host/'
rewrite 'host/' -> 'host'
所以这对我来说似乎没问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)