简体   繁体   English

在IIS上部署PHP应用程序

[英]Deploy PHP application on IIS

I am trying to deploy my CODEIGNITER application on IIS server. 我试图在IIS服务器上部署我的CODEIGNITER应用程序。 My test script hello word is working on IIS but when I move my CI application and checked error log says 404 for any url. 我的测试脚本hello word正在IIS上运行,但是当我移动我的CI应用程序并且检查错误日志时,对于任何URL都会显​​示404。 I tried to add web.config file for rewrite rules on root still error occur here is web.config file 我试图添加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>

try this web.config 试试这个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>

In the config.php file, change $config['uri_protocol']= 'QUERY_STRING' to $config['uri_protocol'] = 'AUTO' . 在config.php文件中,将$config['uri_protocol']= 'QUERY_STRING'更改$config['uri_protocol'] = 'AUTO'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM