避免 dir mod 重写
我有这样的规则:
RewriteRule ^posts/(.*)/([0-9]*)$ viewupdates.php?username=$1&page=$2 [L]
并匹配: http://site.com/posts/username/1
我需要念诵:
http://site.com/username/posts
没有尾部斜杠,如果有更多页面/posts/1
i have a rule like this:
RewriteRule ^posts/(.*)/([0-9]*)$ viewupdates.php?username=$1&page=$2 [L]
and match to: http://site.com/posts/username/1
i need to chante to:
http://site.com/username/posts
without trailing slash, and if have more pages /posts/1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需转置后一种情况的正则表达式的相应部分:
可能,您还需要另一个没有额外“页面”规范的规则(对于您描述的前一种情况),像这样:
或者
取决于您的脚本实现。
Simply transpose the corresponding parts of the regexp for the latter case:
Probably, you also want another rule without the extra "page" specification (for the former case you describe), smth like this:
or
depending on your implementation of the script.