很好的 url 与 apache 和 php
我有类似 /story.php?id=31
的网址 我想将其显示为 /31.html 如何?
I have urls like /story.php?id=31
I want to show it as /31.html
How?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
mod_rewrite
就是答案。请参阅本指南或这个。/31.html
->/story.php?id=31
(呈现链接是另一个更简单的问题)mod_rewrite
is the answer. See e.g. this guide or this one./31.html
->/story.php?id=31
(rendering your links is another - and easier - issue)您需要使用 Apache 的 mod_rewrite 引擎。
您正在寻找的规则看起来像这样:
You'll want to use Apache's mod_rewrite engine.
The rule you are looking for would look something like this:
使用 apache 和 mod_rewrite,可能的解决方案是:
Using apache and mod_rewrite, a possible sollution could be: