Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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"]=~"test.org" {
    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"]=~"r5.test.org" {
    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

1 Answer 1

up vote 0 down vote accepted

as j0k said, use better host matching - `=~"test.org" matches "r5.test.org" 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

 
discard

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.