lighttpd url 重写到子域

发布于 2024-07-26 02:13:11 字数 155 浏览 5 评论 0原文

lighttpd 重写如何进行以下工作?

http://example.com/file_46634643.jpghttp://sub.domain.com/46634643.jpg

如果可能的话...

How does the lighttpd rewrite work for folowing?

http://example.com/file_46634643.jpg to http://sub.domain.com/46634643.jpg

If it's possible...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放血 2024-08-02 02:13:11

对的,这是可能的。 使用 mod_rewrite,这里是一个示例:

url.rewrite-once = ("^/file_([0-9]+\.jpg)$" => "/$1")

查看 Lighttpd 的 mod_rewrite 文档 了解更多详细信息。

Yes, it is possible. Use mod_rewrite, here is an example:

url.rewrite-once = ("^/file_([0-9]+\.jpg)$" => "/$1")

Check Lighttpd's mod_rewrite documentation for more details.

念三年u 2024-08-02 02:13:11

我不认为 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

I don't think mod_rewrite allows you to "rewrite" to another (sub)domain. You could use mod_redirect (but it's a redirect, not a rewrite). Here is a slightly modified version of Bartosz's answer:

$HTTP["host"] == "example.com" {
  url.redirect = ( "^/file_([0-9]+\.jpg)$" => "http://sub.domain.com/$1" )
}

Check http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModRedirect

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文