如何使所有cakephp文件的内部文件夹访问从基地


How to make all cakephp files to inner folder access from base?

目前我的蛋糕结构如下,工作良好

/public_html/app 
/public_html/.htaccess
/public_html/index.php

这样我可以访问mydomain.com到我的应用程序。

我需要创建一个名为src的新内部文件夹,并将所有文件放在public_html*中。

/public_html/*/public_html/src/*

/public_html/src/app 
/public_html/src/.htaccess
/public_html/src/index.php

我需要访问mydomain.com从src文件夹文件。

我尝试创建一个htaccess文件public_html/.htaccess

/public_html/. htaccess

   RewriteEngine on
   RewriteRule    ^$ src/    [L]
   RewriteRule    (.*) src/$1 [L]

,并把所有的文件在蛋糕框架新的内部文件夹src。它给我一个内部服务器错误

然后我创建了一个index.php文件public_html/index.php并删除了public_html中存在的htaccess(public_html/.htaccess)。

index . php

define('SRC_DIR', 'src');
define('DS', DIRECTORY_SEPARATOR);
require SRC_DIR . DS . 'index.php';// src/index.php file

但是它去了页面,但是样式和图像没有出现。

public_html为基路径。

如何在cakephp2中正确设置

除非我遗漏了什么,否则我会继续回答。

据我所知,Justin John想访问这样的内容:

mydomain.com           #access CakePHP
mydomain.com/blah      #access the folder blah

他想将CakePHP移动到public_html/src,并在public_html/中创建他需要的任何子文件夹。这样的:

# THIS IS WRONG
/public_html
   /src             #CakePHP
      /app
      /lib
      /plugins
      /vendors
   /blah
   /another_folder

你应该做的是把CakePHP安装在public_html和任何子文件夹在webroot文件夹。

# This is the Cake way
/public_html
   /app
      /webroot
         /blah
         /another_folder
   /lib
   /plugins
   /vendors

AD7six链接的CakePHP文档中都有解释