我需要从
重定向 http://someserver/someapplication.page.aspx
至
http://someserver.domain.com/someapplication.page.aspx
这两个请求都指向同一台服务器。
someserver/
通过我们公司的内部DNS工作
但我想要一个IIS解决方案,而不是代码。我的猜测是,它会与使用通配符在配置编辑器中添加httpRedirect添加元素有关。
答案 0 :(得分:1)
您可以使用URL Rewrite作为在IIS中执行此操作的方法,只需使用以下规则添加web.config:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to full domain" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^someserver$" />
</conditions>
<action type="Redirect" url="http://someserver.domain.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>