I am getting problems to create Lighttpd rewrite rule for any Wordpress instalation that's situated in the CakePHP application.

The folder structure appears like this:


The cakePHP application works fine. Basically attempt to access http://domain.tld, it loads the application top of the page. Any make an effort to access a controller/action also works fine. The issue occurs when I attempt to load any wordpress publish. The url structure to gain access to a Wordpress publish is: http://domain.tld/blog/post/post-slug

Things I have at this time on /etc/lighttpd/lighttpd.conf is

$HTTP["host"] == "domain.tld" {
    server.document-root        = "/var/www/app/webroot/"
    url.rewrite-once = (
        "/(css|files|img|js|php)/(.*)" => "/$1/$2",
        "^([^\?]*)(\?(.+))?$" => "/index.php?url=$1&$3",

$HTTP["url"] == "domain.tld/blog/" {
    server.document-root        = "/var/www/app/webroot/blog/"
    url.rewrite-final = (
        "^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0",
        "^/(.*.php)" => "$0",
        "^/(.*)$" => "/index.php/$1"

After I attempt to open your blog publish, it opens a webpage that appears to become a damaged cake action. It loads the wedding cake default view (header and footer), but there's nothing around the primary part. Meaning it's calling a controller/action. Basically switch on the debug Configure::write('debug', 2) to determine what's happening, I recieve the next error:

Fatal error: Class 'Debugger' not present in /var/www/cake/libs/i18n.php online 107

On every other area of the application the debugger works fine.

You will find only two methods to access a Wordpress publish. While using default Wordpress permanent link configurations (domain.tld/blog/?p=123) or setting the server.document-root="/var/www/app/webroot/blog/", however in this situation the cakePHP application will not be accessible.

Note: Everything works fine basically use Apache.

I discovered the answer.

Rewrite problem

First, the rewrite. It is actually this:

$HTTP["host"] =~ "domain.tld" {

    server.document-root = "/var/www/app/webroot/"
    url.rewrite-once = (
        "/(css|files|img|js|php)/(.*)" => "/$1/$2",
        "^/blog/(.*)$" => "/blog/index.php/$1",         // to take care of WP
        "^([^\?]*)(\?(.+))?$" => "/index.php?url=$1&$3" // to take care of cakePHP

Class 'Debugger' problem

Now, the Class 'Debugger' not found problem.

  1. chmod 777 /var/www/application/tmp/
  2. Remove any temp file in the same folder

That's the fundamental that I have already done. The main problem was still being there. So this is actually the trick. Proceed using the two steps described above, and hang the debug to zero (). On /app/config/core.php

Configure::write('debug', 0)

Load any page or action. Then, alter the debug to at least one. Load the page again. Finally, alter the debug to two. Load the page and also you will not observe that error any longer.

Sounds crazy however it labored here. Basically had set the debug to two on the very first time I loaded the page, it might throw a mistake.

If that doesn't work, you might like to try the answer that's pointed out on many sites. Add App::import('Core', 'Debugger') prior to the line that's leading to the mistake. It did not work here, however, many have stated it works.