【问题标题】:How to change the url text and not the actual page? [duplicate]如何更改 url 文本而不是实际页面? [复制]
【发布时间】:2014-01-08 05:27:11
【问题描述】:

我的本​​地服务器上有一个页面说http://172.16.2.6:8005/abc.html,我希望测试人员在浏览器中通过http://tesing.com/abc.html 等其他URL 看到它。 该怎么办?

【问题讨论】:

  • 一些上下文将有助于回答。你为什么要这样做?如果是它的测试人员,您应该为他们提供单独的环境。没有?
  • 您需要在网络边缘使用Reverse Proxy 来代理与内部服务器之间的请求。
  • 感谢您的快速回复。我会浏览链接。

标签: javascript jquery html ajax


【解决方案1】:

您需要在您的服务器中设置virtual hosting。我知道您可以在 Apache 中执行此操作,但不确定 IIS

http://httpd.apache.org/docs/current/vhosts/examples.html

您还需要设置本地 dns 服务器 在 Windows 中,转到 C:\Windows\System32\drivers\etc\hosts 并使用测试编辑器打开它,然后在其中添加一行:

172.16.2.6:8005 测试

对于 abc.com 部分,您需要设置 url 重写

【讨论】:

  • 谢谢@Exlord 我会试试dis。
【解决方案2】:

最好在页面加载时在 javascript 中试试这个

window.location="http://tesing.com" + window.location.pathname;

【讨论】:

  • 感谢您的回复,但这对我没有帮助,因为 dis 重定向到 http://tesing.com + window.location.pathname
猜你喜欢
  • 2011-04-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多