dtp87205 2015-09-11 11:31
浏览 67

将Codeigniter .htaccess文件转换为IIS 8的等效web.config文件

I have locally developed project using codeigniter framework and Xampp apache server, url redirection is on and rewrite rules are defined in .htaccess file and working properly, here is my .htaccess file:

RewriteEngine On
RewriteBase /myproject
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

now suddenly client requirement has changed and he wants all windows environment, instead of apache he suggested to use IIS, so i have to move to IIS. Same project with little modifications is running and redirecting default controller which is defined in routes.php file but my other redirections are not working. I searched and found that .htaccess file does not work on IIS need to convert .htaccess file to web.config however i tried to convert my .htaccess to web.config as follows :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="MyRule">
                <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> 

But this does work,giving following error:

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information:

Module IIS Web Core

Notification BeginRequest

Handler Not yet determined

Error Code 0x8007000d

Config Error

Config File \?\C:\inetpub\wwwroot\myproject\web.config Requested URL http://localhost:80/myproject/ Physical Path C:\inetpub\wwwroot\myproject\ Logon Method Not yet determined Logon User Not yet determined

Config Source: -1: 0:

I tried in different ways with different code but it is **showing same error every time,**please help

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 spring后端vue前端
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题
    • ¥15 Visual Studio问题