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>

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...