【发布时间】:2016-09-21 12:59:08
【问题描述】:
我遇到了一个没有为我的 codeigniter 应用程序重写 url 的 web 配置文件。这是网络配置文件。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Clean URL" stopProcessing="true">
<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="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
这是我的网站: http://gandhitomodi.com
我无法获得这种网址 http://gandhitomodi.com/controller/method/
例如
http://gandhitomodi.com/welcome/index/
请帮我解决这个问题。
****已编辑*****
这里是 route.php
$route['default_controller']="welcome/index";
$route['sendmail']="welcome/send";
这是我更改的 config.php 设置。
$config['base_url']="http://gandhitomodi.com/";
$config['index_page']='';
$config['url_protocal']='PATH_INFO';`
【问题讨论】:
-
你使用什么样的网络服务器?通常使用 .htaccess 文件。为什么使用 XML?
-
@Clemenz 它是一个 Windows iis 7.0 服务器而不是 apache,这就是我必须使用 web.config 的原因。
-
只是一个简单的谷歌搜索结果。你试过这个吗? stackoverflow.com/questions/9965124/… 似乎您在配置中错过了一些正则表达式。
-
是的,我也试过了。 @克莱门茨
-
这个怎么样?我对IIS一无所知。所以我不知道你是否有管理面板。 phreek.org/blog/2010/06/codeigniter-url-rewriting-on-iis-7(注意最后一项,更改您的 CodeIgniter 配置 index_page 设置!)
标签: php codeigniter iis web-config