Yii2

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

2017-08-11  本文已影响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>

上一篇下一篇

猜你喜欢

热点阅读