What the title says..

www.example.com is defined in lighttpd.conf as a virtual host:

$HTTP["host"] =~ "(^|\.)example.com$" {
        server.document-root = "/usr/www/example.com/http"
        accesslog.filename = "/var/log/www/example.com/access.log"
        $HTTP["url"] =~ ".pl$" {
                cgi.assign = (".pl" => "/usr/bin/perl" )

However, instead of going by the files listed in index-file.names (the usual index.html, default.html, etc), i want all requests to the root of the virtual host to be forwarded to /cgi-bin/index.pl. What's the easiest/best way of doing this? This need is a special case, and will only apply to this virtualhost. Is it possible to have that particular virtualhost send a redirect in the header?


If you want to send an HTTP redirect:

url.redirect = ( "^/$" => "/cgi-bin/index.pl" )

If you want an internal rewrite:

url.rewrite = ( "^/$" => "/cgi-bin/index.pl" )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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