Need a web.config file instead of .htaccess for codeigniter

后端 未结 1 676
臣服心动
臣服心动 2020-12-22 05:42

I still not able to get the web.config file working no matter how I try it still does not redirect to other pages. I am using codeigniter and hosting the application in IIS

相关标签:
1条回答
  • 2020-12-22 06:23

    Your web.config file should look something like this:

    <?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>
        <httpErrors>
            <remove statusCode="404" subStatusCode="-1" />                
            <error statusCode="404" path="/somedir/oops404.htm" responseMode="ExecuteURL" />                       
        </httpErrors>      
    </system.webServer>
    

    RewriteBase is not used in web.config files as is, so you may need to change the URL paths accordingly.

    0 讨论(0)
提交回复
热议问题