問題描述
Lighttpd 單個子域重定向/重寫 (Lighttpd single subdomain Redirect/rewrite)
I am using lighttpd, and I would like to redirect a subdomain to a regular url, but keep the subdomain showing in the browser.
For example, if I have the following url: http://blog.test.com/...
and I would like to redirect it to: http://test.com/blog/...
but still show blog.test.com/... as the URL in the browser.
What is the best way to go about doing this?
參考解法
方法 1:
You need proxy-core.rewrite-request
with something like that:
$HTTP["host"] =~ "blog.test.com" {
proxy-core.rewrite-request = (
"_uri" => ( ".*" => "/blog/$1" ),
"Host" => ( ".*" => "test.com" ),
)
}
Jump to the proxy-core.rewrite-request
part of the doc.