月別アーカイブ: 2015年3月

さくらインターネットでCakePHPを動作 「500 Internal Server Error」

さくらインターネットでの問題点
マルチドメインの設定でCakePHPを動かすと、「500 Internal Server Error」で動かなくなる。
例)sampdomain ディレクトリにCakePHPをインストールし、「http://sampdomain.example.com/」のようにサブドメインとして設定し、動作させた場合。

以下のように、CakePHP内の3つの.htaccess に RewriteBase を追記することで、この問題は解決できる。

CakePHP内の3つの.htaccess に RewriteBase を追記する。

■home/アカウント/www/sampdomain/.htaccess

RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]

■home/アカウント/www/sampdomain/app/.htaccess

RewriteEngine on
RewriteBase /app
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]

■home/アカウント/www/sampdomain/app/webroot/.htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

コントロールパネルの「ドメイン設定」で、マルチドメインの設定を確認する
※マルチドメインのパス「/sampdomain」の後にはスラッシュを入れてはダメです。

ドメイン名 ウェブ
example.sakura.ne.jp★ マルチドメイン /
example.com マルチドメイン /
sampdomain.example.com マルチドメイン /sampdomain