【发布时间】:2018-07-10 20:21:17
【问题描述】:
我有一个链接 www.example.com 和 www.example.com/user/username 我如何重定向它,以便当有人访问 www.example.com/username 时,他们会得到与使用 user 相同的东西?
所以这些链接将是相同的页面:
www.example.com/user/username/profile-> www.example.com/username/profile
www.example.com/user/username/messages -> www.example.com/username/messages
www.example.com/user/username/chats -> www.example.com/username/chats
我可以在 .htaccess 中进行更改以实现此结果吗?
【问题讨论】:
-
取决于你想要达到的目标;你可能想要一个带有
mod_rewrite的 PHP 路由器(就像 MVC 应用程序经常做的那样)或 per-user web directories 也许......
标签: php html .htaccess url-rewriting