本文介绍了Codeigniter在上传到服务器后抛出404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的项目在localhost上运行良好,但当我将文件上传到服务器时会抛出404。 Wnen我试图访问系统上的另一个页面,例如www.myadress.com/newController它引发一个500内部服务器错误。可能是什么问题?这是我的路线。
$ route ['default_controller'] ='home';
$ route ['404_override'] ='';
$ route ['translate_uri_dashes'] = FALSE;
解决方案config.php 中的
$ config ['base_url'] = '';
$ config ['index_page'] ='';
$ config ['uri_protocol'] ='AUTO';
$ config ['url_suffix'] =''; .htaccess 中的
)
< IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteRule ^(。*)$ index.php / $ 1 [L]
< / IfModule>
autoload.php
$ autoload ['helper'] = array('url');
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;
解决方案
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');
这篇关于Codeigniter在上传到服务器后抛出404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!