【发布时间】:2010-01-19 04:27:42
【问题描述】:
我有一个在不同地理位置运营的网站。我的网站的一些示例 URL 是:
http://losangeles.example.com
http://sandiego.example.com/post/blog/travel/
http://sfbay.example.com/blog/read/12/
在这些示例中,我的 URL 结构被转换为以下内容:
http://[location code].example.com/[controller]/[event]/[extra parameters]
脚本剥离子域并根据数据库检查它是否存在可接受的位置匹配,然后显示该位置中的博客等。
这一切都很好,但现在我正在制作一个使用条款页面,我希望它有 URL:
http://about.example.com/tou
/* which is translated to: */
http://[controller].example.com/[event]
所以本质上,我希望子域有时是位置代码,有时是控制器。
知道我该怎么做吗?或者这只是愚蠢的?
【问题讨论】:
标签: php model-view-controller routing