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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
    • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥120 计算机网络的新校区组网设计
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 海浪数据 南海地区海况数据,波浪数据
    • ¥20 软件测试决策法疑问求解答
    • ¥15 win11 23H2删除推荐的项目,支持注册表等