【问题标题】:Deploy PHP application on IIS在 IIS 上部署 PHP 应用程序
【发布时间】:2016-04-26 04:11:36
【问题描述】:

我正在尝试在 IIS 服务器上部署我的 CODEIGNITER 应用程序。我的测试脚本 hello word 正在 IIS 上运行,但是当我移动我的 CI 应用程序并检查错误日志时,任何 url 都显示 404。我试图添加 web.config 文件以在 root 上重写规则仍然出现错误这里是 web.config 文件

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
  <rewrite>
          <rules>
              <rule name="Index">
              <match url="^(.*)$" />
              <conditions>
                <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>

【问题讨论】:

    标签: php codeigniter iis web-config


    【解决方案1】:

    试试这个web.config

    <?xml version="1.0" encoding="UTF-8"?>
        <configuration>
            <system.webServer>
                <rewrite>
                    <rules>
                        <rule name="Rewrite to index.php">
                            <match url="index.php|robots.txt|images|test.php" />
                            <action type="None" />
                        </rule>
                        <rule name="Rewrite CI Index">
                            <match url="^(.*)$" />
                            <conditions>
                                <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}" appendQueryString="false" /> </rule>
                    </rules>
                </rewrite>
            </system.webServer>
        </configuration>
    

    在config.php文件中,将$config['uri_protocol']= 'QUERY_STRING'改为$config['uri_protocol'] = 'AUTO'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-07
      • 2015-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多