Htaccess以某种方式自动地在URL的末尾删除所有尾部斜杠并且只保留一个.
例如,http:// localhost/api/param1 ///成为http:// localhost/api/param1 /
你能否告诉我为什么会发生这种情况以及如何摆脱这种情况?(.*)应该匹配一切吗?但事实并非如此.就像我说的,如果我去的http://本地主机/ API /参数1 ///的$_GET['url']应该是param1///,但它是param1/.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Run Code Online (Sandbox Code Playgroud)