Iis 10 web.config equivalent of .htaccess

This config seems to be working well on our windows 2016 enviroment.

Maybe it could help somebody.

The important parts are:

  1. defaultDocument
    and
  2. rewrite -> rules

This is a reduced version of the web.config that we use in a testing machine:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <directoryBrowse enabled="false" />
    <defaultDocument>
      <files>
        <clear />
		<add value="app.php" />
      </files>
    </defaultDocument>
    <httpErrors errorMode="DetailedLocalOnly" existingResponse="Auto" />
    <rewrite>
		<rules>
			<rule name="Imported Rule 1" stopProcessing="true">
                     <match url="^.*$" />
                     <conditions logicalGrouping="MatchAny">
                         <add input="{REQUEST_FILENAME}"
                             matchType="IsFile" pattern=""
                             ignoreCase="false" />
                         <add input="{REQUEST_FILENAME}"
                             matchType="IsDirectory"
                             pattern="" ignoreCase="false" />
                     </conditions>
                     <action type="None" />
                 </rule>
                 <rule name="Imported Rule 2" stopProcessing="true">
                     <match url="^.*$" />
                     <action type="Rewrite" url="app.php" />
                 </rule>
				 <rule name="Regla 1 importada" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions>
        <add input="{REQUEST_METHOD}" pattern="^GET" ignoreCase="false" />
        <add input="{DOCUMENT_ROOT}/website/var/assets{URL}" matchType="IsFile" ignoreCase="false" />
      </conditions>
      <action type="Rewrite" url="/website/var/assets{URL}" />
    </rule>
    <rule name="Regla 2 importada" stopProcessing="true">
      <match url="^website/var/tmp.*" ignoreCase="false" />
      <action type="None" />
    </rule>
    <rule name="Regla 3 importada" stopProcessing="true">
      <match url="^website/var/assets.*" ignoreCase="false" />
      <action type="None" />
    </rule>
    <rule name="Regla 4 importada" stopProcessing="true">
      <match url="^plugins/.*/static.*" ignoreCase="false" />
      <action type="None" />
    </rule>
    <rule name="Regla 5 importada" stopProcessing="true">
      <match url="^pimcore/static.*" ignoreCase="false" />
      <action type="None" />
    </rule>
    <rule name="Regla 6 importada" stopProcessing="true">
      <match url="^website/var/.*$" ignoreCase="false" />
      <action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
    </rule>
    <rule name="Regla 7 importada" stopProcessing="true">
      <match url="^plugins/.*$" ignoreCase="false" />
      <action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
    </rule>
    <rule name="Regla 8 importada" stopProcessing="true">
      <match url="^pimcore/.*$" ignoreCase="false" />
      <action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
    </rule>
    <rule name="Regla 9 importada" stopProcessing="true">
      <match url="^.*$" />
      <conditions logicalGrouping="MatchAny">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
      </conditions>
      <action type="None" />
    </rule>
    <rule name="Regla 10 importada" stopProcessing="true">
      <match url="^.*$" />
      <action type="Rewrite" url="app.php" />
    </rule>
		</rules>
    </rewrite>
  </system.webServer>
</configuration>