1and1子目录cakePHP安装问题

时间:2014-01-14 15:58:04

标签: .htaccess cakephp

我正在1and1.co.uk上托管的实时服务器上部署我的应用程序。

我试图让它自8开始工作并且变得疯狂,尝试使用从cakePHP网站下载的新版本。

这是我的配置。

指向目录的子域:

subdomain.mydomain.com => /subdirectory

所以我认为第一个问题是,在我的应用程序的视图中,是一个子目录?

我不这么认为,但我不确定。

我尝试了数百个.htaccess配置,无效,我收到500错误或以下消息:

  

解析错误:语法错误,意外'=',期待'('在第173行/homepages/41/d201409564/htdocs/hire/lib/Cake/bootstrap.php

我认为that topic会解决我的问题,但仍无法解决问题。

感谢您的帮助

2 个答案:

答案 0 :(得分:2)

最终可以通过以下方式解决问题:http://www.grafikart.fr/forum/topic/2351

这是解决方案,诀窍可能是强制执行PHP5,即使它在您的服务器上激活(这是我的情况)

<强> /。htaccess的

AddType x-mapp-php5 .php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

<强> /app/.htaccess

AddType x-mapp-php5 .php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule    ^$ webroot/    [L]
RewriteRule    (.*) webroot/$1 [L]
</IfModule>

<强> /app/webroot/.htaccess

AddType x-mapp-php5 .php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>

答案 1 :(得分:0)

如果有人在CakePHP 4.xx上为此苦苦挣扎,这就是我在IONOS(以前的1and1)上运行它的方式。 CakePHP安装在子目录中:

  • (主目录)
    • 子目录(CakePHP)

/。htaccess

function setRandomInterval(min, max, allowedRepeats) {
  var last,            // keeping the last random value
      repeatCount = 0, // count of repeated value
      getR = function () { return Math.floor(Math.random() * (max - min)) + min; };

  if (min >= max) {
    throw 'Selected interval [' + min + ', ' + max + ') does not work for random numbers.';
  }
    
  return function () {
    var r = getR();
    if (r != last) {  
      repeatCount = 0;  //no repeat yet
    } else if (repeatCount < allowedRepeats) { //new number is equal to last one, but it's still ok
      repeatCount++;  //just increase the number of repeats
    } else {  //new number is equal to last, and allowed number of repeats is reached
      while (r == last) {  //must create a different number
        r = getR();
      }
      repeatCount = 0;  //reset the repeatCount
    }
    return last = r;  //save r as last number and return it
  };
}



var getRandom = setRandomInterval(0, 4, 2);  //call with 2 allowed repeats to allow a sequence of three equal numbers

webroot / .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine on

    #the next two lines are only for forwarding to https
    RewriteCond %{SERVER_Port} !=443
    RewriteRule ^(.*)$ https://yourdomain.com/$1 [R=301,L]
    # end of forwarding

    RewriteBase /
    RewriteRule ^(\.well-known/.*)$ $1 [L]
    RewriteRule ^$ webroot/ [L]
    RewriteRule (.*) webroot/$1 [L]
</IfModule>