IIS的URL REWRITE功能设置

来源:互联网 发布:手机自动应答软件 编辑:程序博客网 时间:2024/05/01 22:52
以APACHE的配置举例

<IfModule mod_rewrite.c>  Options +FollowSymlinks  RewriteEngine On  RewriteCond %{REQUEST_FILENAME} !-d  RewriteCond %{REQUEST_FILENAME} !-f  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]</IfModule>

我们根据.htaccess来改成IIS的版本
步骤1:进入URL重写
步骤2:添加规则-->空白规则
名称:all

【匹配URL】
请求的URL:与模式匹配,使用:正则表达式
模式:^(.*)$

【条件】
逻辑分组:全部匹配。
添加1:{REQUEST_FILENAME}不是文件
添加2:{REQUEST_FILENAME}不是目录

【操作】
操作类型:重写。
操作属性,重写URL:index.php/{R:1}

附上已经配置好的web.config文件

<?xml version="1.0" encoding="UTF-8"?><configuration>    <system.webServer>        <rewrite>            <rules>                <rule name="all">                    <match url="^(.*)$" />                    <conditions>                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />                    </conditions>                    <action type="Rewrite" url="index.php/{R:1}" />                </rule>            </rules>        </rewrite>    </system.webServer></configuration>

 

0 0