pbootcms使用IIS搭建的伪静态规则

2025年10月29日16:33:35 发表评论
微信搜一搜 ts小陈

环境IIS10

IIS重写组件用于配置伪静态规则

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3.     <system.webServer>
  4.         <defaultDocument>
  5.             <files>
  6.                 <add value="index.php" />
  7.             </files>
  8.         </defaultDocument>
  9.         <handlers>
  10.             <add name="PHP" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\php\php-cgi.exe" resourceType="File" />
  11.         </handlers>
  12.         <rewrite>
  13.             <rules>
  14.                 <rule name="reIndex">
  15.                     <match url="^(.*)$" />
  16.                     <conditions>
  17.                         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  18.                         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  19.                     </conditions>
  20.                     <action type="Rewrite" url="index.php?p={R:1}" />
  21.                 </rule>
  22.             </rules>
  23.         </rewrite>
  24.     </system.webServer>
  25. </configuration>

IIS重写组件下载地址

简体中文版: 32位系统x86 /  64位系统x64

此处为最新版本,直接安装即可,老版本Win10安装时会报错,解决方法如下:

打开注册表编辑器,在HKEY_LOCAL_MACHINE-SOFTWARE-Microsoft-InetStp位置把MajorVersion的值改为9之后,就可以安装了,安装完成之后,再把MajorVersion的值改回10。

如果系统更新后会出现IIS起不来,那么也是上面这个问题,需要改回9后修复一下即可。

URL重写规则

上述代码使用iis的重写功能

pbootcms使用IIS搭建的伪静态规则 pbootcms使用IIS搭建的伪静态规则

 

ts小陈

发表评论(不允许含有网址!)

:?: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :cry: :mrgreen: :neutral: :razz:

已登录用户不需要填写以下内容