Asp.net 为新域名重写URL
我正在尝试在IIS中创建url重写。我们已经在服务器上安装了SSL证书,需要所有连接都是HTTPS。HTTPS重写规则似乎工作正常 我们面临的问题是,整个组织的用户都有服务器名称的书签。因此,他们将收到关于服务器名称与证书不匹配的安全警告。示例: 我需要重写域,以便将它们重定向到 我创建的当前规则将重定向到HTTPS。它还会将域从重写为 我的问题是,如果服务器名称后面出现任何内容,它将无法工作。无法工作的域的示例: 有什么建议吗?这是我当前在web.config中的内容Asp.net 为新域名重写URL,asp.net,asp.net-mvc,iis,ssl,url-rewriting,Asp.net,Asp.net Mvc,Iis,Ssl,Url Rewriting,我正在尝试在IIS中创建url重写。我们已经在服务器上安装了SSL证书,需要所有连接都是HTTPS。HTTPS重写规则似乎工作正常 我们面临的问题是,整个组织的用户都有服务器名称的书签。因此,他们将收到关于服务器名称与证书不匹配的安全警告。示例: 我需要重写域,以便将它们重定向到 我创建的当前规则将重定向到HTTPS。它还会将域从重写为 我的问题是,如果服务器名称后面出现任何内容,它将无法工作。无法工作的域的示例: 有什么建议吗?这是我当前在web.config中的内容 <?xml ver
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1" enabled="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^mywebserver\.abcxyz\.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://mywebserver.abcxyz.com/{R:1}" />
</rule>
<rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
</system.webServer>
尝试类似的方法,并同时执行HTTPS,这样您就不会有两个单独的重定向
<rule name="CanonicalHostNameRule1" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="mywebserver.com" />
</conditions>
<action type="Redirect" url="https://mywebserver.abcxyz.com/{R:1}" />
</rule>