Search code examples
.netiisurl-rewriting

URL Rewrite throwing a 500 on one specific folder rule


I am redirecting all traffic through the IIS URL Rewrite Module with the exception of content inside 4 folders. This is for a CMS.

Everything works file except when I add another rule for a folder named public. It keeps throwing 500 errors, which explains nothing to me.

Here is the problmatic web.config

If the public rule is removed, everything works.

<rewrite>
  <rules>
    <rule name="IgnoreManage" stopProcessing="true">
      <match url="^manage/.*"/>
      <action type="None" />
    </rule>
    <rule name="IgnoreContent" stopProcessing="true">
      <match url="^content/.*"/>
      <action type="None" />
    </rule>        
    <rule name="IgnoreServices" stopProcessing="true">
      <match url="^services/.*"/>
      <action type="None" />
    </rule>    
    <rule name="IgnoreServices" stopProcessing="true">
      <match url="^public/.*"/>
      <action type="None" />
    </rule>             
    <rule name="Redirect" stopProcessing="true">
      <match url="(.*)/(.*).html(.*)"/>
      <action type="Rewrite" url="/Default.aspx?Path={R:1}/{R:2}"/>
    </rule>
  </rules>

Here is what I checked

The folder and IIS permissions are the same between:

mysite.myserver.com
mysite.myserver.com-SSL

The virtual folder exists in both places. The web.config is the same in both places.


Solution

  • Found it. Duplicate rule name. Dumb mistake.