API接口在IIS下怎么开放?怎么设置
刚刚安装好CMS,我的环境是IIS,伪静态这些都配置好了,API接口就是访问不通,麻烦帮我看看怎么回事?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- PHP 处理器 -->
<handlers>
<remove name="WebServiceHandlerFactory-ISAPI-4.0_32bit" />
<remove name="SimpleHandlerFactory-ISAPI-4.0_32bit" />
<remove name="PageHandlerFactory-ISAPI-4.0_32bit" />
<remove name="WebServiceHandlerFactory-Integrated-4.0" />
<remove name="SimpleHandlerFactory-Integrated-4.0" />
<remove name="PageHandlerFactory-Integrated-4.0" />
<remove name="WebServiceHandlerFactory-ISAPI-4.0_64bit" />
<remove name="SimpleHandlerFactory-ISAPI-4.0_64bit" />
<remove name="PageHandlerFactory-ISAPI-4.0_64bit" />
<remove name="ASPClassic" />
<add name="php_74" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="D:\BtSoft\php\74\php-cgi.exe" resourceType="File" requireAccess="Script" />
</handlers>
<!-- URL 重写规则 -->
<rewrite>
<rules>
<!-- 规则1:禁止访问缓存目录 -->
<rule name="DenyCache" stopProcessing="true">
<match url="^sd_content/cache/.*" />
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Access denied" />
</rule>
<!-- 规则2:API 重写(修改点:使用 {R:1} 传递路径参数) -->
<rule name="ApiRewrite" stopProcessing="true">
<match url="^api/(.*)$" />
<action type="Rewrite" url="api.php/{R:1}" appendQueryString="true" />
</rule>
<!-- 规则3:前端控制器 -->
<rule name="IndexFallback" stopProcessing="false">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<!-- 关闭详细错误信息 -->
<httpErrors errorMode="Custom" />
</system.webServer>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- PHP 处理器 -->
<handlers>
<remove name="WebServiceHandlerFactory-ISAPI-4.0_32bit" />
<remove name="SimpleHandlerFactory-ISAPI-4.0_32bit" />
<remove name="PageHandlerFactory-ISAPI-4.0_32bit" />
<remove name="WebServiceHandlerFactory-Integrated-4.0" />
<remove name="SimpleHandlerFactory-Integrated-4.0" />
<remove name="PageHandlerFactory-Integrated-4.0" />
<remove name="WebServiceHandlerFactory-ISAPI-4.0_64bit" />
<remove name="SimpleHandlerFactory-ISAPI-4.0_64bit" />
<remove name="PageHandlerFactory-ISAPI-4.0_64bit" />
<remove name="ASPClassic" />
<add name="php_74" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="D:\BtSoft\php\74\php-cgi.exe" resourceType="File" requireAccess="Script" />
</handlers>
<!-- URL 重写规则 -->
<rewrite>
<rules>
<!-- 规则1:禁止访问缓存目录 -->
<rule name="DenyCache" stopProcessing="true">
<match url="^sd_content/cache/.*" />
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Access denied" />
</rule>
<!-- 规则2:API 重写(修改点:使用 {R:1} 传递路径参数) -->
<rule name="ApiRewrite" stopProcessing="true">
<match url="^api/(.*)$" />
<action type="Rewrite" url="api.php/{R:1}" appendQueryString="true" />
</rule>
<!-- 规则3:前端控制器 -->
<rule name="IndexFallback" stopProcessing="false">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<!-- 关闭详细错误信息 -->
<httpErrors errorMode="Custom" />
</system.webServer>
</configuration>
发表回复