如何创建数据库驱动的永久链接? [英] How do I create permalinks that are database driven?
问题描述
我正在寻找一种翻译方法
I'm looking for a way to translate
http://www.mysite.com/articles.php?id=1
进入
http://www.mysite.com/articles/name_of_article_from_field_in_database_with_id_1
我可以用 Mod Rewrite 做某种 RewriteRule,但我不知道具体怎么做.我的页面是用 PHP 编码的,从 MySQL 数据库中提取.
I'm ok with doing some sort of RewriteRule with Mod Rewrite, but I'm not sure how to do it exactly. My pages are coded in PHP pulling from a MySQL database.
希望有人能告诉我如何做到这一点!
Hopefully someone can tell me how to do this!
我知道还有其他人在寻找类似的答案.
I know there are others looking for a similar answer.
再次感谢!
编码器
推荐答案
您将需要在 Web 服务器配置中使用重写规则来翻译例如/123
到 /index.php?id=123
- 这本身不是 PHP 问题.
You're going to need a rewrite rule in your web server configuration to translate e.g. /123
to /index.php?id=123
- it's not a PHP issue per se.
这篇关于如何创建数据库驱动的永久链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!