Tik’s Blog

ร้อยแปดพันเก้า

Fixing CakePHP Tutorial 403/404 problems in Leopard

with 2 comments

In case your newly created CakePHP site looks weird without any styling, try enabling the mod_rewrite (see “8.5 A Note on mod_rewrite“).

You might get a 403 Forbidden error when changing the AllowOverride directive to all. If you get one, open the Console and see Apache’s error log. It might be because you haven’t added FollowSymLinks option. Try adding that and the configuration should look something like:

<Directory “/Users/John/Sites/cake”>

    Options Indexes MultiViews FollowSymLinks

    AllowOverride All

    Order allow,deny

    Allow from all

</Directory>

Now, if everything works fine after that, cool. If you’re getting a 404 Not Found error saying something like:

The requested URL /Users/John/Sites/cake/app/webroot/ was not found on this server.

Chances are because you’re using Web Sharing in Leopard and your site is located in your <home>/Sites directory. If that’s so, try adding the RewriteBase directive to your .htaccess file in Cake’s root directory. The file should now look something like this:

<IfModule mod_rewrite.c>

   RewriteEngine on

   RewriteBase /~John/cake

   RewriteRule    ^$ app/webroot/    [L]

   RewriteRule    (.*) app/webroot/$1 [L]

</IfModule>

Hopefully that’ll fix the problem.

Written by sukita

เมษายน 25, 2008 ที่ 8:49 am

บันทึกโพสใน Uncategorized

Tagged with

2 Responses

Subscribe to comments with RSS.

  1. Thank you very much for this post, although it is still not working for me. I have been trying to get CakePHP to work on Mac OS X 10.4.

    I followed all the advice online. I think mod_rewrite is now working on my mac, after editing the .conf files. But, I went form a 403, to a 404, and now a 500. Following your advice, I am getting an “Internal Server Error”. It is certainly a change, but I don’t know if it is an improvement, or a step in the right direction. Do you have any other ideas?

    Hex Aym

    สิงหาคม 12, 2009 at 9:40 am

  2. Ah-ha!

    I have found the solution!

    Actually, sorry about the previous post. I didn’t follow your instructions clearly.

    I forgot to add the “app/” in the RewriteRule.

    Thank you very much again.

    Hex Aym

    สิงหาคม 12, 2009 at 9:47 am


ใส่ความเห็น