Redirect 如何使用lighttpd中的GET参数将子域指向特定文件?

Redirect 如何使用lighttpd中的GET参数将子域指向特定文件?,redirect,get,web,lighttpd,Redirect,Get,Web,Lighttpd,我想要一个lighttpd服务器在访问者通过子域时重定向/重写到特定页面。这是一个例子 网站启动和运行: www.example.com 上述网站的目标页面: www.example.com/subpage 我希望指向目标页面的子域: www.sub.example.com 因此,当访问者键入:www.sub.example.com时,我希望浏览器显示www.example.com/subpage 这可能吗?如果是的话,你能给我解释一下具体情况吗 我尝试过摆弄vhost.conf文件,但没

我想要一个
lighttpd
服务器在访问者通过子域时重定向/重写到特定页面。这是一个例子

网站启动和运行:

www.example.com
上述网站的目标页面:

www.example.com/subpage
我希望指向目标页面的子域:

www.sub.example.com
因此,当访问者键入:
www.sub.example.com
时,我希望浏览器显示
www.example.com/subpage

这可能吗?如果是的话,你能给我解释一下具体情况吗

我尝试过摆弄vhost.conf文件,但没有用。以下是我尝试过的:

$HTTP["host"] =~ "sub\.example\.com" {
server.document-root = "/var/www/example.com/www/"
server.error-handler-404 = "/index.php" 

index-file.names   = ( "/subpage" )

}

感谢您提前提出的建议

一种方法是使用url.redirect功能,将www.sub.example.com重定向到www.example.com/subpage

$HTTP["host"] =~ "example.com" {
     $HTTP["host"] =~ "www.sub.example.com" {
          url.redirect = (
             "(.*)" => "http://www.example.com/subpage"
          )
     }
     else $HTTP["host"] =~ "www.example.com" {
         server.document-root = "/var/www/example.com/www/"
         server.error-handler-404 = "/index.php"
     }
 }

谢谢你,虽然我不得不添加一些正则表达式的东西,但它还是很有魅力:
$HTTP[“host”]=~“(^ | \)sub\.example\.com$”
再次感谢!