我在ubuntu 14.04 apache 2.4.7中安装了codeigniter 3.0.1,它在带有wamp服务器的Windows中正常运行但是当我将它移动到ubuntu服务器时它继续发生错误,重写模块已经启用,这是我的.htaccess文件:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
这是config.php的配置
$config['base_url'] = 'http://assets1.uofk.edu';
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'AUTO';
这是routes.php配置:
$route['default_controller'] = 'User';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
另外我考虑了命名模型的ubuntu区分大小写但仍未找到错误..请帮助
答案 0 :(得分:0)
尝试检查.htaccess更改
RewriteRule ^(.*)$ index.php?/$1 [L]
并检查你的config.php
$config['base_url'] = 'http://assets1.uofk.edu/';
$config['index_page'] = '';
并检查您的控制器名称必须是User.php,并且您的班级必须是User
答案 1 :(得分:0)
使用此.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ index.php?x=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ index.php [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^(.*)$ index.php [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^(.*)$ index.php/$1 [QSA,NC,L]
这是config.php的配置
$config['base_url'] = 'YOUR_URL';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
.htaccess RewriteRule示例https://www.brontobytes.com/knowledgebase/149/htaccess-RewriteRule-Examples.html