我希望有人能给我一个建议如何解决这个问题。我开发了一个编码程序,刚上传到daddy的子域名。它在本地工作得很好,但是当它在ci.site.com
上运行时,所有的url都被路由到默认控制器。例如,假设我的默认控制器设置为$route['default_controller'] = 'home/index';
。如果我去ci.site.com
,主控制器加载索引方法很好,但是当去ci.site.com/users/index
时,我被路由回home/index
,即使url读取ci.site.com/users/index
。
这是我的/.htaccess
看起来像,CI应用程序和.htaccess
在文档根目录:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
我已经部署了几个CI应用程序,从来没有遇到过这个问题。我的base_url
和index_page
配置参数都是正确的,我似乎无法弄清楚。如有任何建议,不胜感激。
我刚碰到这个。您现在所在的服务器可能没有启用模块mod_rewrite。因此,IfModule !mod_rewrite.c为TRUE。