macbookでcakephpを動かすときのメモ

概要

windowsで作成したcakephpのプログラムをmacbookに移設したとき、403や404エラーが出てしまいました。そのときの対処法をメモしておきます。

対処方法

httpd.confの修正

/etc/httpd/users/ログイン名.conf

<Directory "/Users/ログイン名/Sites/">
#   Options Indexes MultiViews
    Options Indexes MultiViews FollowSymLinks
#   AllowOverride None
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

.htaccessの修正

http://localhost/~user/cake/ で設置したとき

/cake/.htaccess
<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
   RewriteBase /cake
</IfModule>
/cake/app/.htaccess
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
    RewriteBase /cake/app
</IfModule>
/cake/app/webroot/.htaccess
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
    RewriteBase /cake/app/webroot
</IfModule>

投稿日:

ページのトップへ戻る