使lighttpd从www.example.comredirect到www.example.com/cgi-bin/index.pl

标题说什么

www.example.com在lighttpd.conf中定义为虚拟主机

$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" ) } } 

但是,而不是由index-file.names(通常index.html,default.html等)中列出的文件,我希望所有的请求到虚拟主机的根被转发到/ cgi-bin / index特等。 什么是最简单/最好的方法呢? 这个需求是一个特例,只适用于这个虚拟主机。 是否有可能让那个特定的虚拟主机在头部发送redirect

如果你想发送一个HTTPredirect:

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

如果你想要一个内部重写:

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