title: How do I redirect a specific port in the IIS server to an other port
body: <p>My URL Rewrite rule only works for port 80 in IIS .</p>
  
  <p>The rewrite works for : <a href="http://localhost:80" rel="nofollow noreferrer">http://localhost:80</a> --> <a href="http://localhost:8100" rel="nofollow noreferrer">http://localhost:8100</a></p>
  
  <p>The rewrite works for : <a href="http://localhost:80/redirect" rel="nofollow noreferrer">http://localhost:80/redirect</a> --> <a href="http://localhost:8100" rel="nofollow noreferrer">http://localhost:8100</a></p>
  
  <p><strong>The rewrite doesnt work for : <a href="http://localhost:8080" rel="nofollow noreferrer">http://localhost:8080</a> --> <a href="http://localhost:8100" rel="nofollow noreferrer">http://localhost:8100</a></strong></p>
  
  <p><strong>The rewrite doesnt work for : <a href="http://localhost:8080/redirect" rel="nofollow noreferrer">http://localhost:8080/redirect</a> --> <a href="http://localhost:8100" rel="nofollow noreferrer">http://localhost:8100</a></strong></p>
  
  <p>My web.config is following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;configuration&gt;
  &lt;system.webServer&gt;
      &lt;directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension, LongDate" /&gt;
      &lt;rewrite&gt;
          &lt;rules&gt;
              &lt;rule name="Redirect to port 8100" stopProcessing="true"&gt;
                  &lt;match url="(.*)" /&gt;
                  &lt;conditions logicalGrouping="MatchAny"&gt;
                      &lt;add input="{SERVER_PORT}" pattern="^8100$" negate="true" /&gt;
                  &lt;/conditions&gt;
                  &lt;action type="Redirect" url="http://{HTTP_HOST}:8100/{R:0}" /&gt;
              &lt;/rule&gt;
          &lt;/rules&gt;
      &lt;/rewrite&gt;
   &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <blockquote>
    <p>The web.config is only working on default http port 80/443 but not for an specific port.</p>
  </blockquote>
  
  <p>Which changes has to be made in the web.config for working with all ports?</p>