We help IT Professionals succeed at work.

Excluding Ip address in rewrite

I have my rewrite from IIS 7.
One of these rules is causing when I type in my ip address, it's forwarding to the main url instead.
How can I exclude the ip address ***.***.***.*** from redirecting to kars4kids.or
<rules>
                <rule name="LowerCaseRule1" enabled="false" stopProcessing="true">
                    <match url="[A-Z]" ignoreCase="false" />
                    <action type="Redirect" url="{ToLower:{URL}}" />
                </rule>
                <rule name="CanonicalHostNameRule1" enabled="false">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^www\.kars4kids\.org$" negate="true" />
                    </conditions>
                    <action type="Redirect" url="http://www.kars4kids.org/{R:1}" />
                </rule>
                <rule name="INDEX FILES" enabled="false" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="index.*" />
                    <action type="Redirect" url="/" appendQueryString="true" />
                </rule>
            </rules>

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2004
Commented:
Try something like this:

<conditions logicalGrouping="MatchAll">
  <add input="{HTTP_HOST}" pattern="^www\.kars4kids\.org$" negate="true" />
  <add input="{HTTP_HOST}" pattern="^1\.2\.3\.4$" negate="true" />
</conditions>

Open in new window


I'm a little curious if this would work:

  <add input="{HTTP_HOST}" pattern="^(www\.kars4kids\.org|1\.2\.3\.4)$" negate="true" />

Open in new window

Explore More ContentExplore courses, solutions, and other research materials related to this topic.