0

I'm trying to enable IIS 10 to allow custom verbs in PHP. I have PHP_via_FastCGI enabled to accept all verbs. This works correctly when I specify the full path, inclusive of index.php at the end.

The issue is when I don't specify index.php in the URL endpoint. It seems under that circumstance, the StaticFile handler takes over and I get the following error that references the StaticFile handler:

HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.

The StaticFile handler is also set to allow all verbs.

It's also worth noting that during my investigation I have removed all other handlers (aside from PHP_via_FastCGI and StaticFile) for the site for anything referencing a * path. WebDav is also not installed. My Web.config is essentially blank. I have full administrator access to the server.

Is there another way to configure the PHP_via_FastCGI handler to handle default documents, thereby removing the StaticFile handler? Or is there a configuration within StaticFile that I'm missing?

Thanks for your help!

Mike
  • 1
  • 1

1 Answers1

0

I'm not sure if this is the best way, but I have circumvented the issue by disabling the StaticFile handler within Web.config and adding a URL rewrite rule. At first glance, this appears to be working.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
    <handlers>
        <remove name="StaticFile"/>
    </handlers>
    <rewrite>
            <rules>
            <rule name="Lang-Redirect">
                    <match url="(.*)$" />
                    <action type="Rewrite" url="{R:1}/index.php" />
            </rule>
            </rules>
    </rewrite>
    </system.webServer>
</configuration>
Mike
  • 1
  • 1