开发者

CakePHP 1.3 install in subdirectory

开发者 https://www.devze.com 2023-01-27 00:39 出处:网络
I have to deploy my standard install of cakephp 1.3 on a shared host in a subdirectory. Other answers to similar questions didn\'t work for me.

I have to deploy my standard install of cakephp 1.3 on a shared host in a subdirectory.

Other answers to similar questions didn't work for me.

On localhost i have my dev space as a virtual host like

myproject.local.com

that on filesystem is /var/www/myproject/

and there there is the cakephp

so

/app
/app/webroot etc

I have mod_rewrite enabled.

If i want, with the same virtualhost, put my cakephp app under /subfolder/, and access to it as myproject.local.com/subfolder/, what i have to do?

Remember that i can't access to apache config files and i can't put nothing on root.

Any ideas?开发者_如何学运维

It's possible to modify only the htaccess files in subfolder/, subfolder/app/, subfolder/app/webroot with RewriteBase?


You could put the whole cakephp install in the subfolder. If your server allows .htaccess to be overridden then adding this to the .htaccess in the /subfolder/ will help

<IfModule mod_rewrite.c> 
  RewriteEngine  on 
  RewriteRule ^/subfolder$       subfolder/app/webroot/     [L] 
  RewriteRule ^/subfolder/(.*)$ subfolder/app/webroot/$1  [L] 
</IfModule>

But this leaves your app and cake folders accessible from the web.. NotGood(TM)

Another way that I've not tried out yet, but I'm guessing will work is copying just the files from webroot into /subfolder/ then edit the index.php to define the locations of the cake libs

define('APP_DIR', './app');
define('CAKE_CORE_INCLUDE_PATH', '/path/to/cake_1.3');

Then edit routes.php to add a custom route that takes the subfolder into account

Router::connect('/subfolder/:controller/:action*');

You may have to play with the routes a bit to get this working. Good luck.

0

精彩评论

暂无评论...
验证码 换一张
取 消