2015-10-06 165 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>