I'm having problems to setup Lighttpd rewrite rule for a Wordpress instalation that is located inside a CakePHP app.
The folder structure looks like this:
var/
www/
app/
webroot/
blog/
cake/
vendors/
The cakePHP app works fine. If I try to access http://domain.tld
, it loads the app front page. Any attempt to access a controller/action also works fine. The problem happens when I try to load any wordpress post. The url structure to access a WP post is this: http://domain.tld/blog/post/post-slug
What I have right now on /etc/lighttpd/lighttpd.conf
is this
$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"
)
}
When I try to open a blog post, it opens a page that seems to be a broken cake action. It loads the cake default view (header and footer), but there is nothing on the main part. Which means that it is calling a controller/action. If I turn on the debug Configure::write('debug', 2)
to see what is happening, I get the following error:
Fatal error: Class 'Debugger' not found in /var/www/cake/libs/i18n.php on line 107
On any other part of the app the debugger works fine.
There are only two ways to access a WP post. Using the default WP permanent link settings (domain.tld/blog/?p=123
) or setting the server.document-root="/var/www/app/webroot/blog/"
, but in this case the cakePHP app won't be available.
Note: Everything works fine if I use Apache.