404 Not Found
既出の記事がたくさんがあるが自分用のメモ
Cake PHP( ver. 2.2.2 ) で404 Not Found が出る場合の対処法
[0] apache の mod_rewrite が有効になっているか確認
httpd.confで以下の用になっていればOK
LoadModule rewrite_module libexec/apache22/mod_rewrite.so
[1] .htaccess にmod_rewriteに関する設定をする
以下の例は、[document-root]/cakeblog/にCake PHPを配置している場合
まずは、[document-root]/cakeblog/.htaccess
1
2 RewriteEngine on
3 RewriteBase /cakeblog/
4 RewriteRule ^$ app/webroot/ [L]
5 RewriteRule (.*) app/webroot/$1 [L]
6
次は、[document-root]/cakeblog/app/.htaccess
1
2 RewriteEngine on
3 RewriteBase /cakeblog/app/
4 RewriteRule ^$ webroot/ [L]
5 RewriteRule (.*) webroot/$1 [L]
6
最後に[document-root]/cakeblog/app/webroot/.htaccess
1
2 RewriteEngine On
3 RewriteBase /cakeblog/app/webroot/
4 RewriteCond %{REQUEST_FILENAME} !-d
5 RewriteCond %{REQUEST_FILENAME} !-f
6 RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
7
[2] apacheの設定
cakeblog専用の設定ファイルを/usr/local/etc/apache22/Includes/に「cakeblog.conf」として作成して、以下を記す。
1
2 AllowOverride All
3 Order allow,deny
4 Allow from all
5
そして、apacheを再起動して終了