需要一个web.config文件,而不是对的.htaccess codeigniter [英] Need a web.config file instead of .htaccess for codeigniter
本文介绍了需要一个web.config文件,而不是对的.htaccess codeigniter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我还没有能够得到的web.config文件的工作,无论我如何努力仍然无法重定向到其他页面。我使用codeigniter和托管在这里的IIS平台上的应用程序是我的.htaccess文件,请任何人都可以转换成这个code到Web.config文件?
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteBase /旅游/
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$的index.php?/ $ 1 [L]
< / IfModule>
<!IfModule mod_rewrite.c>
的ErrorDocument 404的index.php
< / IfModule>
解决方案
您的web.config文件看起来应该是这样的:
< XML版本=1.0编码=UTF-8&GT?;
<结构>
< system.webServer>
<改写>
<规则>
<规则名称=指数>
<匹配URL =^ $(*)/>
<条件>
<添加输入={} REQUEST_FILENAMEmatchType =ISFILE否定=真/>
<添加输入={} REQUEST_FILENAMEmatchType =IsDirectory否定=真/>
&所述; /条件>
<作用TYPE =重写URL =的index.php / {R:1}/>
< /规则>
< /规则>
< /重写>
< httpErrors>
<删除状态code =404子状态code = - 1/>
<错误状态code =404路径=/ somedir / oops404.htmresponseMode =ExecuteURL/>
< / httpErrors>
< /system.webServer>
的RewriteBase不使用在web.config文件中为是,那么你可能需要相应地改变URL路径。
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 platform here is my .htaccess file, please can anyone convert this code to web.config?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /travel/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
解决方案
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.
这篇关于需要一个web.config文件,而不是对的.htaccess codeigniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文