Mod 当末尾没有反斜杠时,rewrite 会继续附加 GET 字符串
Mod rewrite keeps appending GET string when no backslash at the end is present
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?route=
根据该重写规则,如果我输入任何不以反斜杠结尾的 link,GET
字符串将附加在末尾。
示例:
localhost/forum/ shows as localhost/forum/
localhost/forum shows as localhost/forum/?route=Forum
添加一行RewriteCond %{REQUEST_FILENAME} !-d
所以当指向一个现有目录时它不会做任何事情
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?route=
根据该重写规则,如果我输入任何不以反斜杠结尾的 link,GET
字符串将附加在末尾。
示例:
localhost/forum/ shows as localhost/forum/
localhost/forum shows as localhost/forum/?route=Forum
添加一行RewriteCond %{REQUEST_FILENAME} !-d
所以当指向一个现有目录时它不会做任何事情