我希望在URL中使用斜线,但不要在URL参数之后(如果有的话)。
当前使用:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R=301]
哪个工作于:
www.example.com/test => www.example.com/test/
www.example.com/test/more => www.example.com/test/more/
但是它不适用于以下情况:
www.example.com/test?param=1&rating=3 => www.example.com/test?param=1&rating=3/
www.example.com/test/?param=1&rating=3 => www.example.com/test/?param=1&rating=3/
最后一个应该这样结束:
www.example.com/test?param=1&rating=3 => www.example.com/test/?param=1&rating=3
www.example.com/test/?param=1&rating=3 => www.example.com/test/?param=1&rating=3