如何在 Windows/IIS 中本地定义 URL 解析方式

发布于 2024-11-14 16:55:13 字数 322 浏览 13 评论 0原文

我知道有一种方法可以使任何定义的 URL 解析为不同的 URL,但我不记得如何或在哪里定义此设置。

我知道这是不明确的,所以请考虑以下示例。我正在构建http://www.webapplication.com。我已经在 IIS 7 中设置了该网站。但是,我还没有转发名称服务器来解析我的服务器,因此 URL 完全指向其他位置。但是,当我在本地访问 http://www.webapplication.com 时,我希望解析 IIS 7 网站。

我该怎么做?这是 IIS、单个浏览器(IE 或 Chrome)或其他地方(如我的网络设置)中的设置吗?

I know that there is a way to make any defined URL resolve to a different URL, but I can't remember how or where to define this setting.

I understand this is ambiguous, so consider the following example. I am building http://www.webapplication.com. I have set up the web site in IIS 7. However, I haven't forwarded the nameservers to resolve my server yet, so the URL points to somewhere else completely. However, when I access http://www.webapplication.com locally, I would like the IIS 7 website to be resolved.

How can I do this? Is this a setting in IIS, the individual browser (IE or Chrome) or somewhere else (like my network settings)?

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

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

发布评论

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

评论(2

卷耳 2024-11-21 16:55:13

一种方法是使用您的 HOSTS 文件。您可能需要对其进行编辑,为您的域名添加一个映射到服务器 IP 地址的条目。

这是一篇描述所涉及步骤的博客文章。

One way to do this would be using your HOSTS file. You would want to edit it to add an entry for your domain name that maps to the IP address of the server.

Here's a blog post describing the steps involved.

南渊 2024-11-21 16:55:13

+1 给 optus 关于如何执行此操作的博客文章。为了确保即使 optus 提到的博客文章消失,说明也不会丢失,您需要执行以下操作:

  1. 浏览到开始 ->所有程序 ->附件
  2. 右键“记事本”,选择“以管理员身份运行”,
  3. 在UAC提示下点击“继续”,
  4. 点击文件->打开
  5. 浏览到“C:\Windows\System32\Drivers\etc”
  6. 将文件过滤器下拉框从“文本文档 (.txt)”更改为“所有文件 (.*)”
  7. 选择“主机” ”,然后单击“打开”
  8. 进行所需的更改并关闭记事本。出现提示时保存。

+1 to optus for the blog post on how to do this. Just so the instructions are not lost if the blog post that optus mentions goes away, here is what you need to do:

  1. Browse to Start -> All Programs -> Accessories
  2. Right click "Notepad" and select "Run as administrator"
  3. Click "Continue" on the UAC prompt
  4. Click File -> Open
  5. Browse to "C:\Windows\System32\Drivers\etc"
  6. Change the file filter drop down box from "Text Documents (.txt)" to "All Files (.*)"
  7. Select "hosts" and click "Open"
  8. Make the needed changes and close Notepad. Save when prompted.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文