Apache Mod 重写 Conf 以忽略部分 URL

发布于 2024-11-25 22:27:08 字数 328 浏览 8 评论 0原文

假设我有域名 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

記憶穿過時間隧道 2024-12-02 22:27:08

RewriteRule ^/(\d+) /person.php?id=$1 [QSA,L]

忽略数字后面的所有内容。

RewriteRule ^/(\d+) /person.php?id=$1 [QSA,L]

ignores everthing after the numbers..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文