Home » Php » php – CakePHP: URL rewriting is not properly configured on your server

php – CakePHP: URL rewriting is not properly configured on your server

Posted by: admin July 12, 2020 Leave a comment

Questions:

When I try to run my project (made with cakephp framework), I receive this error:

URL rewriting is not properly configured on your server. Help me configure it I don’t / can’t use URL rewriting

I checked apache httpd.conf file and everything look ok. How can I fix this?

Thanks.

How to&Answers:

Work through the steps in the cookbook for setting up “Apache and mod_rewrite (and .htaccess)” (1.x/2.x/3.x) to make sure you haven’t missed anything. (If that fails, we will need more information.)

Answer:

Ugh. Before you go nuts testing out your Apache config, make sure cake.generic.css is available in your app/webroot/css/ folder. This is a very misleading error message.

The state of URL rewriting is being checked indirectly by checking for access to cake.generic.css (which would only be found if url rewriting is working).

The red error box in the default home.ctp is ALWAYS shown by default. Then the styling in cake.generic.css will hide it via

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

But that means if the cake.generic.css file is not found (e.g. because you deleted it to use your own CSS), the error box will not be hidden, even though URL rewriting is working perfectly fine.

So basically, ignore the URL rewriting error on the default homepage. Try to access one of your controller+views and see if it works.

Answer:

I just got the same problem. The cause was the database config. I solved it by changing this in the database.php file:

class DATABASE_CONFIG {

    public $default = array(
        'datasource' => 'Database/Mysql',...

to this (rockies, please don’t copy the ‘…’ part):

class DATABASE_CONFIG {

     public $default = array(
         'driver' => 'mysql',...

Note: I am working on old cakephp 1.3.10

Answer:

I had the same problem, having all server configured. I’ve finally found this discussion. My problem appeared when I created a default.ctp in app/layouts with some errors. I was calling:

echo $this->element('fancybox_links');

when that element wasn’t ready and solved it by creating that element. So if you have this problem and your httpd.conf seems to be right, check for another cause.

Answer:

I have experienced similar issues when there was a problem with DB connectivity or extension loading (MSSQL on Windows). It is very likely not a URL rewriting issue. Since your phpmyadmin isn’t working either check MySQL configuration.