如何创建一个子域在CakePHP中? [英] How to create a sub-domain in CakePHP?

查看:175
本文介绍了如何创建一个子域在CakePHP中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CakePHP的版本2.5.5

CakePHP version-2.5.5

我的域名是 http://www.thechatfun.com

概况页链接 - http://www.thechatfun.com/users/profile

聊天页面的链接 - http://www.thechatfun.com/chats/index

Chat page link - http://www.thechatfun.com/chats/index

以上两种链接,我想看起来像 http://profile.thechatfun.com 的http://www.chat.thechatfun。 COM

Above two link i want to looks like http://profile.thechatfun.com and http://www.chat.thechatfun.com

我无法使子域在CakePHP的。

I am unable to make subdomain in the CakePHP.

请帮我

谢谢 ChatFun

Thanks ChatFun

推荐答案

只要你可以配置你的域名记录双方聊天和配置文件子域名指向你的服务器,那么你可以改变htaccess的文件在您的根目录文件夹并添加。

As long as you can configure your domain records to point both chat and profile subdomains to your server then you can change the htaccess file in your webroot folder and add..

    <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>

我有这样精确的要求,这对我的作品。

I have this exact requirement and this works for me.

这篇关于如何创建一个子域在CakePHP中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆