外部页面的修改重写规则? [英] Mod-rewrite rule for external pages?
问题描述
是否可以使用mod_rewrite解析其他伺服器上的寄存地址?
Is it possible use mod_rewrite to resolve addresses hosted on another server?
说我要设定这个网址:
http://www.myserver.com/myfolder/
$ b b
实际解析为:
To actually resolve to:
http://www.anotherserver.com/anotherfolder/
如果是这样,你能提供一个RewriteRule例子吗?
If so, could you provide a RewriteRule example?
-thanks
推荐答案
您可以使用 P 标记 http://httpd.apache.org/docs/2.2/mod/mod_rewrite.htmlrel =nofollow noreferrer> mod_rewrite 规则来获取 mod_proxy :
You can use the P flag in a mod_rewrite rule to get that substitution URL requested by mod_proxy:
RewriteEngine on
RewriteRule ^myfolder/$ http://other.example.com/anotherfolder/ [P]
现在,当客户端从您的服务器请求 / myfolder /
时,它会请求 http://other.example。 com / anotherfolder /
,并将响应从该服务器发回客户端。
Now when a client is requesting /myfolder/
from your server, it will request http://other.example.com/anotherfolder/
and send the response from that server back to the client.
这篇关于外部页面的修改重写规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!