zoukankan      html  css  js  c++  java
  • IIS的URL REWRITE功能设置

    以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>
    飞儿传媒www.firadio.com
  • 相关阅读:
    (第九周)视频发布及git统计报告
    (第九周)团队项目16
    (第九周)团队项目15
    (第九周)团队项目14
    C# 中请求数据方式
    C#中Json和List/DataSet相互转换
    C#枚举注释实例
    C#常用简单线程实例
    C#动态多线程实例
    MySql中文乱码
  • 原文地址:https://www.cnblogs.com/firadio/p/5006357.html
Copyright © 2011-2022 走看看