CakePHP 版本 2.5.5
我的域名是http://www.thechatfun.com
个人资料页面链接 - http://www.thechatfun.com/users/profile
聊天页面链接 - http://www.thechatfun.com/chats/index
以上两个链接我希望看起来像 http://profile.thechatfun.com
和 http://www.chat.thechatfun.com
我无法在 CakePHP 中创建子域。
请帮帮我
谢谢 聊天乐趣
最佳答案
只要您可以配置域记录以将聊天和个人资料子域都指向您的服务器,那么您就可以更改 webroot 文件夹中的 htaccess 文件并添加..
<IfModule mod_rewrite.c>
#standard cake htaccess stuff
...
RewriteCond %{HTTP_HOST} ^profile\.thechatfun\.com$ [NC]
RewriteRule ^(.*)$ http://www.thechatfun.com/users/profile/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^chat\.thechatfun\.com$ [NC]
RewriteRule ^(.*)$ http://www.thechatfun.com/chats/index/$1 [R=301,L]
</IfModule>
我有这个确切的要求,这对我有用。
关于php - 如何在 CakePHP 中创建子域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27080996/