mod_rewrite:从另一台服务器提供图像
我如何编写 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 Pekka 正确提到的,您可以发送重定向 ([R=301]),也可以使用代理标志 ([P]) 将请求发送到特定服务器。使用代理方法,您将丢失有关请求客户端的日志记录信息,因为您的服务器 mysite.example 连接到 mystaticfiles.example 并从中获取内容。您还可以在系统中使用代理将带宽加倍。
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.