Asp.net 在web.config中重定向到www时忽略IP

Asp.net 在web.config中重定向到www时忽略IP,asp.net,redirect,web-config,seo,url-redirection,Asp.net,Redirect,Web Config,Seo,Url Redirection,出于SEO目的,我在web.config文件中有这部分代码。它允许我将所有URL重定向到网站URL的www格式(例如,它将abc.com重定向到www.abc.com) 现在我的问题是它还将我的网站IP重定向到www格式(我的意思是它将123.123.123.123重定向到www.123.123.123) 如何将我的网站的IP从该操作中排除?Thanx提前。只需添加另一个否定规则来测试条件的远程添加 <rule name="Redirect to www" stopProcessing

出于
SEO
目的,我在
web.config
文件中有这部分代码。它允许我将所有URL重定向到网站URL的www格式(例如,它将
abc.com
重定向到
www.abc.com


现在我的问题是它还将我的网站IP重定向到www格式(我的意思是它将
123.123.123.123
重定向到
www.123.123.123


如何将我的网站的IP从该操作中排除?Thanx提前。

只需添加另一个否定规则来测试条件的远程添加

<rule name="Redirect to www" stopProcessing="true" >
  <match url="(.*)"/>
  <conditions>
    <add input="{HTTP_HOST}" pattern="^www\." negate="true"/>
    <add input="{REMOTE_ADDR}" pattern="123\.123\.123\.123" negate="true" />
  </conditions>
 <action type="Redirect" url="http://www.{HTTP_HOST}{HTTP_URL}" redirectType="Permanent" appendQueryString="false"/>
</rule>

为什么不直接说出来-

<rule name="Redirect to www" stopProcessing="true" >
  <match url="(.*)"/>
  <conditions>
    <add input="{HTTP_HOST}" pattern="^www\." negate="true"/>
    <add input="{REMOTE_ADDR}" pattern="123\.123\.123\.123" negate="true" />
  </conditions>
 <action type="Redirect" url="http://www.{HTTP_HOST}{HTTP_URL}" redirectType="Permanent" appendQueryString="false"/>
</rule>