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'],
6 Likes

THANK YOU! I was just about resigned to finding a new web host, but I came here to search for β€œIIS” just in case. Your solution worked instantly and saved me a headache.

Hello, does this also work for the panel? I did this but I can’t access the panel. Thanks!

try adding (i couldn’t test this):

<rule name="panel" stopProcessing="true">
          <match url="^panel/(.*)" ignoreCase="false" />
          <conditions>
            <!--# make panel 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="panel/index.php" />
        </rule>

if thats works please let me know, so i can include that in the original post.

Hello,
Thank you, but unfortunately it does not change. I still get the message: The panel cannot be installed

  • Kirby requires Apache, Nginx or Caddy

have you added this line
'servers' => ['apache', 'symfony', 'IIS'],
to the config.php file?

yes. That is the line that causes the error. If I comment it out, I can access the panel. But then I imagine I could not delpoy the site

what webserver are you using locally during development? this server must be present in the config.servers as well. i just tested in my local setup and had to add nginx to the list.

like: 'servers' => ['apache', 'symfony', 'iis', 'nginx'],

could you resolve your issue?

Thanks so much! I’m usisng the Kirby PHP local server so I added β€˜PHP’ to config.servers and it works!