美文网首页Yii2
适用于 Yii2 / Laravel等框架的IIS Url Re

适用于 Yii2 / Laravel等框架的IIS Url Re

作者: 方圆百里找对手 | 来源:发表于2017-08-11 11:26 被阅读34次

    web.config 的Url Rewrite

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="Deny Cvs Access" stopProcessing="true">
                        <match url=".(svn|git|ht|DS)$" />
                        <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Deny Access" />
                    </rule>
                    <rule name="Static Access" stopProcessing="true">
                        <match url=".(ico|js|css|png|jpg|gif|swf|pdf|mov|fla|zip|rar|txt|gz|tar)$" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        </conditions>
                        <action type="None"/>
                    </rule>
                    <rule name="Hide Index" stopProcessing="true">
                        <match url="." ignoreCase="false" />
                        <conditions>
                            <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>
        </system.webServer>
    </configuration>
    
    

    相关文章

      网友评论

        本文标题:适用于 Yii2 / Laravel等框架的IIS Url Re

        本文链接:https://www.haomeiwen.com/subject/gqylrxtx.html