php REST应用程序从Apache迁移到IIS

php REST应用程序从Apache迁移到IIS,php,apache,.htaccess,iis,web-config,Php,Apache,.htaccess,Iis,Web Config,我有带.htaccess的slim框架和通过http协议调用api的前端应用程序 在Apache上,调用/api/v1/login——返回JSON响应 在IIS上执行相同调用时,它返回/index.php的html内容 apache.htaccess是: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L] IISweb.config(来自Sl

我有带.htaccess的slim框架和通过http协议调用api的前端应用程序

Apache上,调用/api/v1/login——返回JSON响应

在IIS上执行相同调用时,它返回/index.php的html内容

apache.htaccess是:

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]
IISweb.config(来自Slim framework网站):



我从api收到错误500,这意味着可能url重写工作

您是否在IIS管理器|连接|处理程序映射中为*.php配置了模块映射?我有*.php的fastcgimodule-我是否需要使用fastcgimodule配置*,以便api/api/v1/login工作?
<?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>