lighttpd 重写如何为以下工作?
http://example.com/file_46634643.jpg
至http://sub.domain.com/46634643.jpg
如果它是可能的...
lighttpd 重写如何为以下工作?
http://example.com/file_46634643.jpg
至http://sub.domain.com/46634643.jpg
如果它是可能的...
对的,这是可能的。使用 mod_rewrite,这里是一个例子:
url.rewrite-once = ("^/file_([0-9]+\.jpg)$" => "/$1")
查看Lighttpd 的 mod_rewrite 文档以获取更多详细信息。
我不认为 mod_rewrite 允许您“重写”到另一个(子)域。您可以使用 mod_redirect (但它是重定向,而不是重写)。这是 Bartosz 答案的略微修改版本:
$HTTP["host"] == "example.com" {
url.redirect = ( "^/file_([0-9]+\.jpg)$" => "http://sub.domain.com/$1" )
}
检查http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModRedirect