<rules>
    <clear />
    <rule name="Versienummer">
        <match url="appl/fac/fac_verify.asp" />
        <action type="Rewrite" url="appl/fac/fac_verify.asp?rewriterversion=1.00" />
    </rule>

    <!-- /api2/attachments/sample.doc?...                   /default.asp?api2=attachments&filename=sample.doc&... -->
    <rule name="attachments" stopProcessing="true">
        <match url="^api2/([a-z0-9_]+)/(\d+)/attachments/(.*)/(.*)/?" />
        <action type="Rewrite" url="default.asp?mode=attachment&amp;api2={R:1}&amp;id={R:2}&amp;subfolder={R:3}&amp;filename={UrlEncode:{R:4}}" appendQueryString="true" />
    </rule>
    <!-- /api2/buildings/          /default.asp?api2=doc&format=doc -->
    <rule name="Add trailing slash" stopProcessing="true">
      <match url="^api2$" />
      <action type="Redirect" redirectType="Permanent" url="api2/" />
    </rule>
    <rule name="api2doc" stopProcessing="true">
        <match url="^api2/$" />
        <action type="Rewrite" url="default.asp?api2=doc&amp;format=doc" appendQueryString="true" />
    </rule>
    <!-- /api2/buildings/1234.xml?...          /default.asp?api2=buildings&format=xml&id=1234&... -->
    <rule name="api2SingleRecord" stopProcessing="true">
        <match url="^api2/([a-z0-9_]+)/(\d+)\.(xml|json|html|api|scf|doc)/?" />
        <action type="Rewrite" url="default.asp?api2={R:1}&amp;format={R:3}&amp;id={R:2}" appendQueryString="true" />
    </rule>
    <rule name="scfSingleRecord" stopProcessing="true">
        <match url="^api2/([a-z0-9_]+)/(\d+)/?" />
        <action type="Rewrite" url="default.asp?api2={R:1}&amp;format=scf&amp;id={R:2}" appendQueryString="true" />
    </rule>
    <!-- /api2/buildings.xml?...               /default.asp?api2=buildings&format=xml&... -->
    <rule name="api2List" stopProcessing="true">
    	<match url="^api2/([a-z0-9_]+)\.(xml|json|html|api|scf|doc)/?" />
    	<action type="Rewrite" url="default.asp?api2={R:1}&amp;format={R:2}" appendQueryString="true" />
    </rule>
    <rule name="scfList" stopProcessing="true">
    	<match url="^api2/([a-z0-9_]+)/?" />
    	<action type="Rewrite" url="default.asp?api2={R:1}&amp;format=scf" appendQueryString="true" />
    </rule>
    <!-- 2015.1 experimenteel: -->
    <rule name="unsupportedMelding" stopProcessing="true">
    	<match url="^melding/(\d+)" />
    	<action type="Rewrite" url="default.asp?u=melding&amp;k={R:1}" appendQueryString="true" />
    </rule>
</rules>
