mod_rewrite:从另一台服务器提供图像

发布于 2024-09-10 01:24:43 字数 164 浏览 1 评论 0原文

我如何编写 mod_rewrite 规则来处理所有请求,例如 http://mysite.example/images/IMAGE.gif|jpg|png 并提供服务 http://mystaticfiles.example /IMAGE.gif|jpg|png

谢谢

how can i write a mod_rewrite rule to handle all the requests like http://mysite.example/images/IMAGE.gif|jpg|png and serve instead http://mystaticfiles.example/IMAGE.gif|jpg|png ?

Thanks

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

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

发布评论

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

评论(1

清秋悲枫 2024-09-17 01:24:43

正如 Pekka 正确提到的,您可以发送重定向 ([R=301]),也可以使用代理标志 ([P]) 将请求发送到特定服务器。使用代理方法,您将丢失有关请求客户端的日志记录信息,因为您的服务器 mysite.example 连接到 mystaticfiles.example 并从中获取内容。您还可以在系统中使用代理将带宽加倍。

client connection -> mysite.example -> proxy request to mystaticfiles.example
-> mystaticfiles.example sends file -> mysite.example -> sends file to client

As Pekka correct mentioned, you can send a Redirect ([R=301]) or you could use a the Proxy-flag ([P]) to send the request to a specific server. With the proxy method, you will lose the logging information about the requesting client, because you server mysite.example connect to mystaticfiles.example and grabs the content from their. You also double the bandwith, with in your system with a proxy.

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