我正在尝试在Apache中配置url重定向.我尝试了一些方法,没有任何作用.有人可以告诉我解决方案,因为它似乎并不太难.
我将重定向来自:
https://myhost/configuration/jmx-console
Run Code Online (Sandbox Code Playgroud)
至:
http://myanohterhost/jmx-console
Run Code Online (Sandbox Code Playgroud)
这是一个https到http重定向.
有人能指出我正确的方向吗?
非常感谢!
Bri*_*acy 10
您可以使用该RedirectMatch指令强制Apache将用户发送到其他位置:
RedirectMatch 301 ^(.*)$ http://www.anotherserver.com$1
Run Code Online (Sandbox Code Playgroud)
请参阅以下内容:
http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch
http://en.wikipedia.org/wiki/URL_redirection#HTTP_status_codes_3xx
在当前服务器(或虚拟主机)“myhost”的配置中,执行此操作的正常方法如下:
Redirect /configuration/jmx-console http://myanohterhost/jmx-console
Run Code Online (Sandbox Code Playgroud)
编辑:根据您的评论,您似乎可以使用以下技术之一来做到这一点:
只需将远程服务器的 url 映射到本地 url:
ProxyPass /configuration/jmx-console http://myanohterhost/jmx-console
ProxyPassReverse /configuration/jmx-console http://myanohterhost/jmx-console
Run Code Online (Sandbox Code Playgroud)
RewriteRule ^configuration/jmx-console(.*)$ http://myanohterhost/jmx-console$1 [P]
Run Code Online (Sandbox Code Playgroud)
像这样使用反向代理可能有一些注意事项,我建议您仔细阅读http://httpd.apache.org/docs/2.2/en/mod/mod_proxy.html以查看使用反向代理时可用的各种选项。
| 归档时间: |
|
| 查看次数: |
70866 次 |
| 最近记录: |