Azuaron
Azuaron

Reputation: 21

CakePHP 2.0.4 "URL rewriting is not properly configured on your server"

I've been trying to setup CakePHP on a development section of my server and I can't seem to solve the "URL rewriting is not properly configured on your server" error. I suspect I'm not configuring the .htaccess files with the correct RewriteBase. I've tried a wide variety of different RewriteBase for each file, but I can't seem to hit the right ones, and Cake doesn't give me any information other than "not working" (URL rewrite errors don't end up in Cake's error log).

I do not have access to my httpd.conf file, but I've used .htaccess and mod_rewrite with other frameworks (Wordpress and CodeIgniter) without a problem.

My base url for the site is: http://dev.domain.com/cake/

My base server path is: /home/username/public_html/dev/cake/

Cake root .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /cake
    RewriteRule    ^$ app/webroot/    [L]
    RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

Cake app directory .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /cake/app
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

Cake webroot directory .htaccess:

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

Upvotes: 2

Views: 10757

Answers (4)

Eric Weaver
Eric Weaver

Reputation: 63

The problem for me was the css issue mentioned in another answer.

If you changed the css file in the default layout, you might need to add the following lines to your new css file:

#url-rewriting-warning {
    display:none;
}

... as long as rewriting appears to be working in all other ways.

Upvotes: 0

Abe
Abe

Reputation: 51

Problem is with CSS. If U don't make page on default layout of cake, and in your new layout You dont have default css: cake.generic.css it will show this error on page home.ctp. Look in code of home.ctp (View/Pages) and look - the id="url-rewriting-warning" of <p> where this error message is have in cake.generic.css value of display:none.

Upvotes: 4

lp1051
lp1051

Reputation: 501

What does your vhost.conf look like? If you have a proper path in DocumentRoot, you shouldn't need to specify RewriteBase in .htaccess at all. Just stick with the defaults.

Try DocumentRoot /home/username/public_html/dev/cake/app in vhost, and remove RewriteBases from your .htaccess.

Upvotes: 0

Moz Morris
Moz Morris

Reputation: 6751

Did you create a new default.ctp layout file and then "URL rewriting is not properly configured on your server." appeared?

If that is the case, it happened to me. It's working just fine. I think Cake is throwing a bad error message here.

Upvotes: 6

Related Questions