我想为不同的用户创建域
我有 www.football.com
和 www.baseball.com
等域名。
它们与父级 www.game.com
及其管理页面 www.game.com/admin
链接。
我想为不同的用户创建诸如 www.football.com/userid1/admin
、www.baseball.com/userid2/admin
等内容。
所有域都映射到同一 IP,并且只有一个管理文件夹。如果我使用CakePHP,是否可以实现上述目标?
I have domains like www.football.com
and www.baseball.com
.
They are linked with www.game.com
, which is the parent, and its admin page, www.game.com/admin
.
i want to create something like www.football.com/userid1/admin
, www.baseball.com/userid2/admin
, etc. for different users.
All the domains are mapped to same IP and there is only one admin folder. If I use CakePHP, is it possible to achieve the above?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
做起来很简单,但在细节上却很挑剔。您将 Apache 配置为将所有这些域指向同一组 PHP 文件,然后只需检查 $_SERVER['HTTP_HOST'] 即可查看实际请求的域:
在您的其余部分中适当小心代码和模板,您可以轻松确定要输出哪个站点的图像/样式表/内容,但基本上对所有这些都使用相同的核心逻辑。
It's simple to do, but gets nitpicky in the details. You configure Apache to point all those domains to the same set of PHP files, then you simply check
$_SERVER['HTTP_HOST']
to see which domain was actually requested:With appropriate care in the rest of your code and templates, you can easily determine which site's images/stylesheets/content to output, but basically use the same core logic for all of them.