2015-10-06 163 views
0

我希望你能帮助我,我很接近但在最后一道关卡失败。IIS URL重写重定向到基地

我试图将我的网站的一部分重定向到主页,如果没有从某些IP浏览。但是,重定向失败。

例子:

网站网址:www.mysite.com 受限路径:www.mysite.com/secure

当人们浏览,如果他们试图也就是说,到/安全路径I希望该网站自动重新指向www.mysite.com

目前发生的事情是他们正在转发到www.mysite.com/www.mysite.com,我不知道为什么。

这是我的URL重写规则:

<rewrite> 
     <rules> 
      <rule name="Lockdown" stopProcessing="true"> 
       <match url=".*" /> 
       <conditions> 
        <add input="{REMOTE_ADDR}" pattern="123.123.123.123" negate="true" /> 
        <add input="{REMOTE_ADDR}" pattern="111.111.111.111" negate="true" /> 
        <add input="{PATH_INFO}" pattern="^/secure(.*)" /> 
       </conditions> 
       <action type="Redirect" url="http://{Host_Header}" appendQueryString="false" /> 
      </rule> 
     </rules> 
    </rewrite> 

任何想法,为什么我的重定向实际上应该是什么?

回答

0

对于任何有类似问题的人,下面的重写规则解决了我的问题。有效地,我拿出了网址的http://方面,但我不确定它为什么会起作用。

<rule name="Lockdown" stopProcessing="true"> 
    <match url=".*" /> 
    <conditions> 
    <add input="{REMOTE_ADDR}" pattern="123.123.123.12" negate="true" /> 
    <add input="{REMOTE_ADDR}" pattern="111.222.33.45" negate="true" /> 
    <add input="{PATH_INFO}" pattern="^/secure(.*)" /> 
    </conditions> 
    <action type="Redirect" url="/{Host_Header}" appendQueryString="false" /> 
</rule>