php - 如何在 CakePHP 中创建子域?

标签 php .htaccess cakephp

CakePHP 版本 2.5.5

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

个人资料页面链接 - http://www.thechatfun.com/users/profile

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

以上两个链接我希望看起来像 http://profile.thechatfun.comhttp://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/

相关文章:

PHP Image Zoom - 指数级

PHPMailer 邮件程序错误 : Message body empty

javascript - 如何在同一页面一键刷新两个表单

html - 字体图标不显示

cakePHP 分页器未传递 passargs

CakePHP 3.x : Cache paginated search

unit-testing - 调用一些 testActions 会使测试崩溃

php - 从 Content-Disposition header 中提取带有特殊字符的文件名

.htaccess - 默认添加语言子目录 "sv/"(重定向)

.htaccess - Moodle 数据根位置不安全错误