在官网下载安装 rewrite 插件,https://www.iis.net/downloads/microsoft/url-rewrite
安装完成后,配置 web.confing 文件,在 <system.webServer> 标签中加入以下配置内容:
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<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>
完整 web.confing 配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<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>
配置好之后重启IIS即可,在后台的固定链接中修改设置,即可隐藏 URL 中的 index.php。
红包分享
钱包管理

