【发布时间】:2011-11-03 14:31:14
【问题描述】:
我在 Google 上阅读了很多关于转向的内容
profile.php?id=24 变成对用户更友好的东西。
我将如何重定向一个链接,如
www.site.com/profile/username
到
profile.php?id=userid (find from username)
谢谢
【问题讨论】:
-
How to create friendly URL in php? 和 How can I make the URL search engine friendly? 和 tons of others 的可能重复项。请在提问前使用搜索。
-
其实初始链接一般更像
www.site.com/profile/userid/username。用户名只是为了方便而在 URL 翻译中使用。例如,看看 SO 是如何工作的。 -
你可以做一些研究。这个问题的答案已经在 Google 上找到了 530 万次
-
我始终相信本网站用户的答案,而不是在 Google 上找到的随机文章。
-
@Cicada,我理解你所说的用户 ID 和用户名在一起的意思。比运行查询从用户名中查找 id 更有意义。
标签: php url-rewriting