zoukankan      html  css  js  c++  java
  • 关于IIS上Yii2的Url路由美化

    Yii2默认的路由是酱紫的

    http://.../admin/web/index.php?r=site/login

    心中理想的美化Url应该这样  http://.../admin/web/site/login

    在指定模块的web目录新建web.config,复制粘贴下面代码就OK了!

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <httpErrors errorMode="Detailed" />
            <rewrite>
    			<rules>
    				<rule name="OrgPage" stopProcessing="true">
    					<match url="^(.*)$" />
    					<conditions logicalGrouping="MatchAll">
    						<add input="{HTTP_HOST}" pattern="^(.*)$" />
    						<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>
    

    可能会遇到其他问题,欢迎留言

    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    final-第十章
    路由器基本配置-命令行配置模式
    路由器基本配置-对话配置模式
    配置静态路由
    默认路由
    像素值的读写
    矩阵的基本元素表达
    创建Mat对象
    Mat类
    数学基础-3D空间的位置表示
  • 原文地址:https://www.cnblogs.com/cxscode/p/7143647.html
Copyright © 2011-2022 走看看