Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem configuring mod_rewrite in two hosts with Lighttpd.

I have one which is a newer version of the old. The old doesn't use mod_rewrite, while the new one does. However, the problem is that if I enable the module in lighttpd.conf then, the old one make all the redirects, even when I'm not configuring it to have any redirect.

This is my conf file:

$HTTP["host"]=~"" {
    server.document-root = "/var/www/virtual/acruz/www/public/"
    server.errorlog      = "/var/www/virtual/acruz/logs/error.log"
    accesslog.filename   = "/var/www/virtual/acruz/logs/access.log"

    url.rewrite-once = (
        ".*\.(js|ico|gif|jpg|png|css|)$" => "$0",
        "^/.*(\?.*)"                     => "/index.php$1",
        ""                               => "/index.php"

$HTTP["host"]=~"" {
    server.document-root   = "/var/www/virtual/acruz/r5/"
    server.errorlog        = "/var/www/virtual/acruz/logs/error.log"
    accesslog.filename     = "/var/www/virtual/acruz/logs/access.log"
    setenv.add-environment = ("env" => "acruz")
share|improve this question
Have you tried to replace =~ with == for both host ? – j0k Jan 26 '13 at 10:57
up vote 0 down vote accepted

as j0k said, use better host matching - `=~"" matches "" too.

also you can have only one server.errorlog (you don't get a config warning/error yet, but it will use only one of the configured files).

share|improve this answer
Thanks a lot! This works! – AbrahamSustaita Jan 27 '13 at 3:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.