最近做了一个项目,使用的是我自己基于thinkphp开发的一套CMS,由于我本地使用的都是apche的环境,即使是线上环境用的也是宝塔面板,但是现在要将thinkphp的系统部署在IIS8.0的环境下,由于路由我设置过伪静态,而原本的 .htaccess 在 IIS 环境下没有什么作用,所以需要单独写一个IIS上的规则,给大家分享下:

以下代码的使用环境:IIS7.5,采用web.config方式实现伪静态

不多上了,直接上代码:Thinkphp .htaccess转iis web.config代码

使用很简单,在www的更目录新建 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>

配置完成。

相关文章:

  • 2021-11-08
  • 2021-10-01
  • 2021-04-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2021-11-28
  • 2021-08-07
猜你喜欢
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2021-12-03
  • 2021-12-26
  • 2021-12-28
  • 2021-06-23
相关资源
相似解决方案