重定向https辅助域Web配置

时间:2018-07-27 12:26:31

标签: asp.net-mvc dns iis-7 web-config url-redirection

我的主机中有一个辅助域

我想阅读 https://Mydoaminname.com

但是在添加此代码后,对于重定向,这是我的问题地址栏:

https://Mydoaminname.com/Mydoaminname /

<configuration>

    <system.web>

  <httpRuntime enableVersionHeader="false" targetFramework="4.5" />
    <compilation debug="true" targetFramework="4.5"/>

    </system.web>
  <system.webServer>


   <httpProtocol>
      <customHeaders>
      <clear />
        <remove name="X-Powered-By" />
      </customHeaders>
   </httpProtocol>

    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files\(compressionType)\(AppPool)\(WebSite)\compressed files">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" />
      <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="application/xaml+xml" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </staticTypes>
    </httpCompression>



    <urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true"/>




  </system.webServer>

</configuration>

此重写代码对于主要域非常有用,但对于次要域,其make地址栏问题

        <rules>
            <clear />
            <rule name="Redirect to https" stopProcessing="true">
                <match url=".*" />

                <conditions>
                    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
            </rule>
        </rules>
    </rewrite>

0 个答案:

没有答案