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>
可能会遇到其他问题,欢迎留言
版权声明:本文为博主原创文章,未经博主允许不得转载。