2013-01-20 27 views
-1

目前我的蛋糕的结构非常像的下方,所以做工精细如何使所有的cakephp文件从基地的内部文件夹访问?

/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 

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

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

/public_html/.htaccess

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

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

然后我创建了一个index.php文件public_html/index.php和删除htaccess(public_html/.htaccess)出现在public_html。

的index.php

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

但它道出页,但风格和图像不来了。路线不起作用。

public_html是基本路径。

如何使cakephp2中正确?

+0

@faa我需要从'public_html/src/index.php',而不是'http:// domain.com/src/index.php'访问'http:// domain.com/index.php' '的public_html/SRC/index.php'。 –

+0

为什么你的网站上安装了开发风格? – AD7six

+0

您想访问应用程序,就像它安装在根目录中一样,但实际上在'src'文件夹中有CakePHP基础文件? – rlcabral

回答

1

除非我错过了一些东西,否则我会继续回答。

从我的理解,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,并在根目录文件夹中所有子文件夹中。

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

这是所有在the CakePHP documentation解释说,AD7six链接。

+0

请注意[您可以将目录布局](http://book.cakephp.org/2.0/en/installation/advanced-installation.html)配置为任何所需的置换 - 即'app','webroot'和'lib/Cake文件夹不必拥有这种布局,它们可以在任何地方。 – AD7six

相关问题