THINKCMF5 部署到 Windows服务器

问题一

【public/index.php是项目的入口文件,请配置服务器时把 public 目录做为 web 目录】这是官方文档的一句话。如何将public 目录做为 web 目录?

解答:在IIS或者apache或者ngx里设置网站目录。

问题二

设置成功网站目录后,除了首页可以访问成功。其他页都是404如何解决?

解答:伪静态问题。在public目录下添加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>

        <directoryBrowse enabled="false" />

                <security>

          <requestFiltering allowDoubleEscaping="True" />

        </security>

        <defaultDocument>

            <files>

                <clear />

                <add value="index.php" />

                <add value="Default.htm" />

                <add value="Default.asp" />

                <add value="index.htm" />

                <add value="index.html" />

                <add value="iisstart.htm" />

            </files>

        </defaultDocument>

    </system.webServer>

     

</configuration>

posted @ 2019-05-27 13:38  贾博然  阅读(825)  评论(0编辑  收藏  举报