Yii2默认的路由是酱紫的
http://.../admin/web/index.php?r=site/login
心中理想的美化Url应该这样 http://.../admin/web/site/login
在指定模块的web目录新建web.config
<?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>转自:https://www.cnblogs.com/cxscode/p/7143647.html
浙公网安备 33010602011771号