[英]CodeIgniter upgrade from 2.2.0 to 3.0.x: Only the default controller is loading
我通常不会在网络上发布消息来寻求帮助,但是我觉得我已经尝试了所有方法,并且陷入了困境。
我想将CodeIgniter从2.2版升级到3.0.3版(我也尝试了v3.0.2版),并且遵循了codeigniter.com上的相应指南 。 但是现在,无论URL是什么,都仅加载默认控制器。
我在网上搜索过,发现它可能来自:
但是我仍然没有解决方案...
它必须是路由问题...
这是我已经完成的一些测试: 测试表
这是我的htaccess文件(我也在网上尝试了其他文件,结果相同):
RewriteEngine On #Checks to see if the user is attempting to access a valid file, RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #Enable access to the images and css folders, and the robots.txt file RewriteCond $1 !^(index\.php|public|images|robots\.txt|css) RewriteRule ^(.*)$ index.php/$1 [L]
这是我的“ application / config / routes”文件:
$route['default_controller'] = 'dashboard'; $route['404_override'] = 'auth/e404'; $route['translate_uri_dashes'] = FALSE;
任何帮助,将不胜感激 :-)
谢谢 !
解
$ config ['enable_query_strings']在文件“ application / config / config.php”中设置为“ TRUE”。 将其设置为“ FALSE”可以解决此问题。 很简单...
在Codeigniter 3 Wamp中
我用这个htaccess
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
由于出现错误404,骑行不能在子文件夹中。
更改
$route['404_override'] = 'auth/e404';
至
$route['404_override'] = 'e404';
并在config.php上
$config['base_url'] = 'http://localhost/your_project/';
// You can leave base url blank but not recommended because when you try to submit forms make cause issue.
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
尝试将index方法放在路由中,例如代替
$route['blog'] = 'blog';
尝试这个
$route['blog'] = 'blog/index';
并且,如果这不起作用,您可以确认已在application / config / config.php中设置了正确的基本url吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.