Apache Mod 重写 Conf 以忽略部分 URL
假设我有域名 http://www.example.com
。
当我浏览到 http://www.example.com/12345
时,它会从数据库中为我带来 ID 为 12345 的人。我希望它能够工作,即使我在 URL 末尾写了一些其他无意义的字符; http://www.example.com/12345/qwerty
。
这是当前配置:
RewriteRule ^/(\d+)$ /person.php?id=$1 [QSA,L]
我应该向此配置添加什么?
Let's say I have the domain http://www.example.com
.
When I browse to http://www.example.com/12345
it brings me the person having id 12345 from database. I want it to work even I write some other meaningless bunch of characters at the end of the URL; http://www.example.com/12345/qwerty
.
This is the current config:
RewriteRule ^/(\d+)$ /person.php?id=$1 [QSA,L]
What should I add to this config?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
RewriteRule ^/(\d+) /person.php?id=$1 [QSA,L]
忽略数字后面的所有内容。
RewriteRule ^/(\d+) /person.php?id=$1 [QSA,L]
ignores everthing after the numbers..