CakePHP 開発環境構築 /home/ユーザー配下での設定

さんらいおん

2009年12月30日 10:00

CakePHPの開発環境を/home/ユーザー配下に作成します。
※「ユーザー」は各自のユーザーID

今回は公開ディレクトリwebrootをpublic_html配下に
それ以外を/home/ユーザー配下に置きます。

ディレクトリ構成は以下の通り
/home/ユーザー/
public_html/* ← ここにwebroot/配下を移動
cake/ ← ここにcakeディレクトリを配置

1)public_html/index.phpの設定変更

/**
* The full path to the directory which holds "app", WITHOUT a trailing DS.
*
*/
if (!defined('ROOT')) {
define('ROOT', DS. 'home'. DS. 'ユーザー'. DS. 'cake');
}
/**
* The actual directory name for the "app".
*
*/
if (!defined('APP_DIR')) {
define('APP_DIR', 'app');
}

2)/public_html/.htaccessの修正

RewriteEngine On
RewriteBase /~ユーザー/ ← 1行追加 ドキュメントルートを設定しないと正しく動かない
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

関連記事