A-A+

.htaccess转换为web.config规则

2015年11月19日 IIS 暂无评论 阅读 294 次浏览 次

 最近在学习ThinkPHP ,客户端环境是win7+iis7.5,想开启REWRITE模式.

thinkphp生成代码中自带了.htaccess重写规则,IIS7.5只要导入就可以了。

首先确认已经安装iis7 url重写模块,这个在微软站点可以下到

xxx1

点击URL重写选项进入如下界面

xxx2

点击右侧入站规则-》导入规则

xxx3

要导入的规则->配置文件  选择要导入的.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>

 

标签:

评论已关闭!

Copyright © 香港虚拟主机_美国虚拟主机_香港服务器_美国服务器租用托管 保留所有权利.   Theme  Ality 蜀ICP备14006632号-1

用户登录