<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <security>
            <requestFiltering>
                <fileExtensions allowUnlisted="true" applyToWebDAV="true" />
                <verbs allowUnlisted="true" applyToWebDAV="true" />
                <hiddenSegments applyToWebDAV="true">
                    <clear />
                    <add segment="web.config" />
                    <add segment=".history" />
                    <add segment=".vscode" />
                </hiddenSegments>
                <requestLimits maxAllowedContentLength="330000000" />
            </requestFiltering>
        </security>
        <rewrite>
            <rules>
                <clear />
                <!-- <rule name="nonwww2www" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_HOST}" pattern="^sangqiao\.com$" />
                    </conditions>
                    <action type="Redirect" url="https://www.sangqiao.com/{R:1}" redirectType="Permanent" appendQueryString="true" />
                </rule> -->
                <!-- <rule name="ensurewww" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{CACHE_URL}" pattern="^(.+)://(?!www)(.*)" />
                    </conditions>
                    <action type="Redirect" url="{C:1}://www.{C:2}" redirectType="Permanent" />
                </rule> -->
                <!-- <rule name="http2https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
                </rule> -->
                <rule name="ThinkPHP_NiPaiYi" enabled="true" stopProcessing="true">
                    <match url="^((?!blog)[^\.]*)(\.html)?$" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
                </rule>
                <rule name="禁止某些文件夹php执行" enabled="true" stopProcessing="true">
                    <match url="(upload/|uploads/|thkdata/|data/runtime/|.tmp/).+\.php(/|$)" />
                    <action type="AbortRequest" />
                    <conditions logicalGrouping="MatchAny">
                    </conditions>
                </rule>
                <rule name="RequestBlockingRule1" stopProcessing="true">
                    <match url="^(thkcmf51|thinkcmf5).*$" />
                    <action type="CustomResponse" statusCode="403" statusReason="Forbidden: " statusDescription="Access is denied." />
                </rule>
            </rules>
        </rewrite>
        <!-- <httpErrors errorMode="Custom">
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" path="/404.htm" responseMode="ExecuteURL" />
        </httpErrors> -->
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />
            </files>
        </defaultDocument>
        <httpErrors errorMode="DetailedLocalOnly" />
        <handlers>
            <clear />
            <add name="php-7.4.33" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="D:\inetpub\php-7.4.33-nts-Win32-vc15-x64\php-cgi.exe" resourceType="Either" requireAccess="Script" />
            <add name="WebDAV" path="*" verb="PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" />
            <add name="ISAPI-dll" path="*.dll" verb="*" modules="IsapiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" />
            <add name="CGI-exe" path="*.exe" verb="*" modules="CgiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" />
            <add name="SSINC-stm" path="*.stm" verb="GET,HEAD,POST" modules="ServerSideIncludeModule" resourceType="File" />
            <add name="SSINC-shtm" path="*.shtm" verb="GET,HEAD,POST" modules="ServerSideIncludeModule" resourceType="File" />
            <add name="SSINC-shtml" path="*.shtml" verb="GET,HEAD,POST" modules="ServerSideIncludeModule" resourceType="File" />
            <add name="TRACEVerbHandler" path="*" verb="TRACE" modules="ProtocolSupportModule" requireAccess="None" />
            <add name="OPTIONSVerbHandler" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" />
            <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
        </handlers>
    </system.webServer>
</configuration>
