Search code examples
mod-rewritelighttpd

Lighttpd url rewrite not working


Whenever I try subdomain.localhost/whatever/assets/images/realImage.jpg it shows mir the image at folder/assets/images/realImage.jpg and works like a charme. Also for subdomain.localhost/whatever/favicon.ico it presents folder/favicon.ico. But as I try subdomain.localhost/whatever it will not give me folder/sitemap.xml.

I also tried to debug using debug.log-request-handling (will not rewrite the request) and debug.log-condition-handling (result: of condition is true). So does anyone have a clue?

This is my lighttpd.conf snipplet (mod_rewrite is activated).

$HTTP["host"] == "subdomain.localhost" {
    server.document-root = "folder"
    $HTTP["url"] != "test" {
        url.rewrite = (
             "."                                => "/sitemap.xml",
        )
    }
    url.rewrite = (
        "assets/(.*)$"                          => "/assets/$1",
        "(favicon.ico|sitemap.xml|robots.txt)"  => "/$1",
    )
}

Solution

  • See Support url.rewrite (handle_uri_raw callbacks) in $HTTP["url"] and $HTTP["query-string"] which fixed in 1.4.34.