Codeigniter throws 404 after uploading to server

徘徊边缘 提交于 2020-01-16 00:45:24

问题


My project runs well on localhost but throws a 404 when I upload the files to a server. Wnen I try to access another page on the system, eg www.myadress.com/newController it throws a 500 internal server error. What could be the problem? This is what my routes look like

$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

回答1:


use this.

in config.php

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '';

in .htaccess (This should place out side application folder)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>

in autoload.php

$autoload['helper'] = array('url');


来源:https://stackoverflow.com/questions/30840815/codeigniter-throws-404-after-uploading-to-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!