2017-03-21 35 views
1

在使用Windows 2006 R2的VPS上我想编辑web.config文件,以便在几个子文件夹中找到的所有页面都从http重定向到https。使用web.config强制http对特定子文件夹的https IIS

我在下面找到了这个建议,我想知道的是如何列出这个重写规则将被应用的特定文件夹。

的子文件夹:

/SECURE1/

/secure2/

/ADMIN1/

/Admin2的/

任何帮助和建议将不胜感激:)

<configuration> 
<system.webServer> 
    <rewrite> 
     <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> 
</system.webServer> 

+0

您好NepCoder,为您的解决方案的感谢。我会在今天晚些时候尝试一下并提供反馈。 –

+0

您是否能够正常工作? – NepCoder

+0

嘿!谢谢你的跟进。这是一个疯狂的忙碌的一周,我打算早点报告。代码是在...服务器重写模块,但是另一个问题LOL。经过一番研究,似乎有解决方法,但他们需要目前我没有的专业水平。我将在几个月内将该网站迁移到Windows 2012环境中,然后再测试一切。再次感谢您的帮助:) –

回答

0

这样的事情呢?

<rule name="test" stopProcessing="true"> 
    <match url="(secure1|secure2|admin1|admin2).*" /> 
    <conditions> 
     <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
    </conditions> 
    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /> 
</rule> 

得到了这个网址的信息,如果您想了解更多: https://forums.iis.net/t/1176994.aspx?Https+Redirect+for+certain+folders+sections+only

相关问题