thinkphp5在iis7下隐藏index.php

时间:2021-06-30 19:59:38

在根目录下创建 web.config 文件

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
        <rules>
            <rule name="OpenSourceBMS" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="^(.*)$" ignoreCase="true" negate="false" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="true" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="true" negate="true" />
                </conditions>
                <action type="Rewrite" url="index.php?s={R:1}" />
            </rule>
        </rules>
        </rewrite>
    </system.webServer>
</configuration>