开发者

htaccess "Object not found" CakePhp on XAMP and MAC OS X

Probably you have seen these question pop up a lot on Google. However, I went through most of all documents I could find, I still could not fix my current problem.

I still getting this error when I access http://mydomain.com/phpserver/pages/websocket

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404

localhost
Thu May 5 12:09:38 2011
Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1

However, it works fine with a URL like this: http://mydomain.com/phpserver/index.php/pages/websocket

But of course, the CSS and Javascript are not loaded properly. So the following are what I have been trying to do:

I did modify httpd.conf in the XAMPP/xamppfiles/etc folder. I made sure that the server allow mod_rewrite.

I also add my working directory into this file:

Alias /phpserver /Users/username/WebSites/phpserver/webroot/
<Directory "/Users/username/WebSites/phpserver">
    Options Indexes FollowSymLinks ExecCGI Includes  
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

I also modified the DocumentRoot configuration so that:

<Directory />
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    #XAMPP
    Order allow,deny
    Allow from all
</Directory>

Those are the configurations for the apache

For CakePHP I also "bake" the whole project using the console ./cake bake appname

I checked all .htaccess and they are followed what people on the web recommended. This is the one located at the root of the application

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
 </IfModule>

And this is the one located inside the webroot folder

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

Please help! I have spent 开发者_运维百科so much time on this :(

Thanks in advance


Edit: I fixed the problem by adding this into .htaccess inside the webroot folder: RewriteBase /phpserver/

So it turns out to be like this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜