tp5 thinkphp5 index.php隐藏 iis 重写 伪静态

面临的问题如下:

网上找了个源码,tp5的,公司服务器是iis,源码是隐藏index.php使用了路由,iis默认去找那个路径的文件了,找不到,所以报错了

如果没有iis没有安装"url重写"的,请去网上找找教程,这个仅作为我自己用,可能有点乱

项目的根目录写一个web.Config文件,然后内容如下(具体我也没看内容,网上找的,我也看不懂,哈哈)

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

然后重启一下网站,就可以了,哈哈