使用 Cpanel cakephp 在新应用程序目录中设置子域
我有工作domain.kz与cakephp(Cpanel托管)
www/应用
www/蛋糕
www/index.php
如何将 admin.domain.kz 设置为 (app2)
www/app
www/app2
www/蛋糕
www/index.php
I have working domain.kz with cakephp (Cpanel hosting)
www/app
www/cake
www/index.php
how can i setup admin.domain.kz to (app2)
www/app
www/app2
www/cake
www/index.php
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你想要的方式——将会非常困难;您必须在多个位置更改多个文件/文件夹路径。相反,为什么不尝试创建一个 admin 文件夹,其中包含用于管理的完整 cakephp 应用程序。
因此,最终的文件夹结构将如下所示:
然后,您必须将子域 (admin.domain.kz) 指向
/www/admin
。现在假设您已正确配置域和子域,如果您尝试浏览您的域,它不会出现任何问题,但如果您尝试访问您的子域,则会出现 500 错误。不用担心。这是预料之中的。
主 .htaccess 文件强制由主 Webroot (www/app/webroot) 文件夹提供服务的所有请求。您必须像这样更改您的主 .htaccess 文件 (www/.htaccess):
请注意,我添加了两行,告诉您如果您尝试访问您的子域,请停止重写;否则照常重写。干杯!!!
The way you want it - will be very difficult; you'll have to change several file/folder paths in several places. Instead, why don't you try to create an admin folder where you've the full cakephp application for admin.
So the resulting folder structure would be like this:
Then you'll have to point your subdomain (admin.domain.kz) to
/www/admin
.Now assuming that you've configured your domain and subdomain correctly, if you try to browse your domain, it'll work with no issues but if you try to access your subdomain, it'll give you a 500 error. DON'T WORRY. It is expected.
The primary .htaccess file is forcing all requests served by primary webroot (www/app/webroot) folder. You'll have to change your primary .htaccess file (www/.htaccess) like this:
Notice that, I've added two lines which tells that if you're trying to access your subdomain, stop rewriting; otherwise rewrite as usual. Cheers!!!
如果蛋糕应用程序完全独立,但共享一个蛋糕库,那么以下方法可能有效:
一旦为 admin.domain.kz 设置了 DNS,您就可以使用 cPanel 的“Addon Domain”功能。 可以在此处找到说明。
将插件域的文档根目录设置为 www/app2 文件夹。
然后只需确保 www/app2/webroot/index.php 中的 CAKE_CORE_INCLUDE_PATH 指向 ../../../cake
If the cake apps are totally separate but share a cake library then the following might work:
You could use cPanel's 'Addon Domain' feature, once the DNS has been set up for admin.domain.kz. Instructions can be found here.
Set the document root of the addon domain to the www/app2 folder.
Then just make sure that CAKE_CORE_INCLUDE_PATH in www/app2/webroot/index.php points to ../../../cake