我在这里有一个代码,它通过在末尾添加斜杠来重写 url。健康)状况:
RewriteEngine On
RewriteCond %{REQUEST_URI} !\..*$
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/Brian/$1$2/ [L,R=301]
Run Code Online (Sandbox Code Playgroud)
如果网址是:
http://localhost:8080/Brian/test123 -> http://localhost:8080/Brian/test123/ - CORRECT
http://localhost:8080/Brian/test123. -> http://localhost:8080/Brian/test123. - CORRECT
http://localhost:8080/Brian/test123.awd -> http://localhost:8080/Brian/test123.awd - CORRECT
http://localhost:8080/Brian/test123.awd/a -> http://localhost:8080/Brian/test123.awd/a - THIS IS MY PROBLEM
Run Code Online (Sandbox Code Playgroud)
我想做出这样的结果。
http://localhost:8080/Brian/test123.awd/a/
Run Code Online (Sandbox Code Playgroud)
请帮忙。谢谢!