How to: Run Kirby3 on Microsoft IIS (Internet Information Services)

Hej all,

as i could not find any tutorial or working solution on the internet, i painfully figured a way to run kirby 3 on microsoft IIS. in the end its quite straight forward.

1. replace the .htaccess with a web.config file

<?xml version="1.0" encoding="utf-8"?>
<!-- the root web configuration file -->
<configuration>
    <system.webServer>
        <directoryBrowse enabled="false" />
        <security>
          <requestFiltering allowDoubleEscaping="true"/>
        </security>
        <rewrite>
          <rules>
            <rule name="rule 1J" stopProcessing="true">
              <match url="(^|/)\.(?!well-known\/)"  />
              <action type="Rewrite" url="/index.php"  />
            </rule>
            <rule name="rule 2J" stopProcessing="true">
              <match url="^content/(.*)"  />
              <action type="Rewrite" url="/index.php"  />
            </rule>
            <rule name="rule 3J" stopProcessing="true">
              <match url="^site/(.*)"  />
              <action type="Rewrite" url="/index.php"  />
            </rule>
            <rule name="rule 4J" stopProcessing="true">
              <match url="^kirby/(.*)"  />
              <action type="Rewrite" url="/index.php"  />
            </rule>
            <rule name="Importierte Regel 5" stopProcessing="true">
              <match url="^(.*)" ignoreCase="false" />
              <conditions>
                <!--# make site links work-->
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
              </conditions>
              <action type="Rewrite" url="index.php" />
            </rule>
          </rules>
        </rewrite>
    </system.webServer>
</configuration>

2. add IIS to supported servers in config.php

   'servers' => ['apache', 'symfony', 'IIS'],
4 Likes