IIS Rewrite Rules - documentation correct?


#1

Hi,

I’ve been using Slim on Apache (Xampp) on Windows for quite a while now, it works fine and my .htaccess file is ok for Apache. I’ve recently tried to move over to IIS so I can use some PaaS hosting but when I deploy to either a local IIS server on Windows 10 or the Azure App Service, I am getting 500 errors when configuring as per the documentation at https://www.slimframework.com/docs/start/web-servers.html

I’ve checked and PHP is working (uploaded a file that calls phpinfo(). It will also serve HTML pages no problem. When I change the rewrite rules (removing negate for example) then I can alter the error message from a 500 to 404 or even a 403 but can’t find what needs to change to make it work.

Any ideas and is the documentation correct?

I’m on Windows 10, PHP 5.6.31, IIS 10.

The Web Config currently has only the below:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="slim" patternSyntax="Wildcard">
                    <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

#2

I’ve managed to get this going (after trying all afternoon and finding it 10 mins after this question). I had to install PHP7 due to some non slim dependencies in my project. The documentation is correct and works