与
ESC
输入关键词搜索文章

IIS7配置YII2的url重写规则

全文约 94 字预计阅读 1 分钟
安装个yii2.0.9玩玩,网上一搜索竟然没有iis的配置方法,见鬼了难道没人用iis了,只能靠自己摸索了,首先要安装我之前写的:IIS7.5伪静态URL_rewrite模块,接着再yii2对应的项目web目录下创建web.config,把一下内容复制进去即可,配置分享如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
 <rewrite>
 <rules>
                <rule name="YII2">
                    <match url=".*" ignoreCase="false" />
                    <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?r={R:0}" />
                </rule>
  
 </rules>
</rewrite>
   </system.webServer>  
</configuration>
 </system.webServer>
 </configuration>
IIS7配置YII2的url重写规则
分享

发表评论

评论 0 条

暂无评论,来说点什么吧。