.htaccess转换为web.config规则
最近在学习ThinkPHP ,客户端环境是win7+iis7.5,想开启REWRITE模式.
thinkphp生成代码中自带了.htaccess重写规则,IIS7.5只要导入就可以了。
首先确认已经安装iis7 url重写模块,这个在微软站点可以下到
点击URL重写选项进入如下界面
点击右侧入站规则-》导入规则
要导入的规则->配置文件 选择要导入的.htaccess文件
点导入,就会在下方读取规则
之后右侧操作->应用,就可以了
在.htaccess下就会生成一个web.config文件,里面包含了重写的配置
thinkphp由iis7.5转换后规则如下
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”已导入的规则 1″ stopProcessing=”true”>
<match url=”^(.*)$” ignoreCase=”false” />
<conditions logicalGrouping=”MatchAll”>
<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>
</rules>
</rewrite>
</system.webServer>
</configuration>
评论已关闭!