关于我们

热门关键字

  • .CN域名开放注册!
  • 独立IP
新闻公告

帮助:Thinkphp 在IIS7.5,IIS8.5,IIS11.0 上 web.config伪静态规则!

来源:三维主机发布时间:2025/3/27

因我公司提供的网站空间都是采用的windows系统,IIS版本分别为IIS7.5,IIS8.5,IIS10.0,因此Thinkphp自带的伪静态规则.htaccess是无法使用的,必须转换为web.config才行,下面是转换好的代码:

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

    <system.webServer>

 <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>

将以上代码,保存到web.config文件内,上传到网站根目录,即可使用。如果您不会使用,可以联系在线客服协助。