【发布时间】:2020-10-22 09:01:08
【问题描述】:
我在这里有一个代码,它通过在末尾添加斜杠来重写 url。 条件:
- 无文件扩展名
- 末尾没有斜线
RewriteEngine On
RewriteCond %{REQUEST_URI} !\..*$
RewriteRule ^(.*)([^/])$ http://%{HTTP_HOST}/Brian/$1$2/ [L,R=301]
如果网址是:
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
我想做出这样的结果。
http://localhost:8080/Brian/test123.awd/a/
请帮忙。谢谢!
【问题讨论】:
标签: regex apache .htaccess mod-rewrite