zoukankan      html  css  js  c++  java
  • IIS配置ThinkPHP重写

    IIS10+ThinkPHP6:

    根目录public下新建web.config

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 
     3 <configuration>
     4 <location path="." inheritInChildApplications="false">
     5     <system.webServer>
     6         <rewrite>
     7             <rules>
     8                 <rule name="OrgPage" stopProcessing="true">
     9                     <match url="^(.*)$" />
    10                     <conditions logicalGrouping="MatchAll">
    11                         <add input="{HTTP_HOST}" pattern="^(.*)$" />
    12                         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    13                         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    14                     </conditions>
    15                     <action type="Rewrite" url="index.php/{R:1}" />
    16                 </rule>
    17             </rules>
    18         </rewrite>
    19     </system.webServer>
    20     </location>
    21 
    22 </configuration>
    <location path="." inheritInChildApplications="false"></location>
    标签在根目录解除子目录的继承,若没有虚拟目录只部署在根目录,则删除标签(只删第4、第20行)。

    虚拟目录webconfig的配置

    虚拟目录webconfig不变,用网上抄的。

    另网上有另外解决:

    2.在子目录对冲突的节点处理

    根目录节点

    1 <connectionStrings>
    2     <add name="DBConnectionString" connectionString="Data Source=.;Initial Catalog=test;User ID=sa;Password=sa123" providerName="System.Data.SqlClient"/>
    3   </connectionStrings>

    子目录节点

    1 <connectionStrings>
    2     <clear/>
    3     <add name="DBConnectionString" connectionString="Data Source=.;Initial Catalog=test;User ID=sa;Password=sa123" providerName="System.Data.SqlClient"/>
    4   </connectionStrings>

    在冲突的节点前先clear,清除之前的配置,然后再加载下面的配置就可以了,除了clear 还有remove也可以

     <connectionStrings>
        <remove name="DBConnectionString"/>
        <add name="DBConnectionString" connectionString="Data Source=.;Initial Catalog=test;User ID=sa;Password=sa123" providerName="System.Data.SqlClient"/>
      </connectionStrings>

    这种配置方法可以用在所有的节点上,使用起来也比较灵活

  • 相关阅读:
    Ubuntu-14.04-QT开发环境搭建-(一)
    解决使用Qt creator时出现Cannot overwrite file ..Permission denied
    Github上关于大数据的开源项目、论文等合集
    Qt5.4中遇到找不到头文件<QApplication>等。
    qt的下载地址
    完整的qt安装教程
    Ubuntu14.04安装Matlab2014a
    Ubuntu14.04安装搜狗输入法的一点小问题
    把OnDraw和OnPaint弄清楚(转贴)
    Ubuntu上挂载源代码,docker容器中共享这个原代码,实现自动部署
  • 原文地址:https://www.cnblogs.com/xwhgr/p/15292343.html
Copyright © 2011-2022 走看看