[英]codeigniter is not working after uploading in the server
My site http://www.bishal.prtia.com/prT_base/
throw an 404
error while loading in the server. 我的网站
http://www.bishal.prtia.com/prT_base/
在服务器中加载时抛出404
错误。
It works perfectly in the localhost
. 它在
localhost
可以完美运行。 I tried changing everything that mentioned in this forum like changing .htaccess
to web.config and changing base url routing config etc but it still throws an error. 我尝试更改此论坛中提到的所有内容,例如将
.htaccess
更改为web.config并更改基本url路由配置等,但仍会引发错误。
You need to do few steps. 您需要执行几个步骤。
base_url
in config.php
config.php
base_url
RewriteBase
in .htaccess
.htaccess
RewriteBase
error_reporting(E_ALL)
in index.php
and see what it says index.php
添加error_reporting(E_ALL)
并查看其内容 Check the following things once again: 再次检查以下内容:
RewriteEngine on RewriteCond $1 !^(index\\.php|assets|images|js|css|upload|favicon.png) RewriteCond %(REQUEST_FILENAME) !-f RewriteCond %(REQUEST_FILENAME) !-d RewriteRule ^(.*)$ ./index.php/$1 [L]
Then check following thigs: Config.php 然后检查以下提示:Config.php
Routes.php Routes.php
Make sure php file name of controller start with capital letter like Welcome and also inside that file as well when inherit from CI_Controller 确保控制器的php文件名以大写字母开头(如Welcome),并且在从CI_Controller继承时也位于该文件内
Function inside Welcome.php: Welcome.php内部的功能:
public function index()
{
$this->load->view('your view file');
}
Thanks 谢谢
I also faced this error. 我也遇到了这个错误。 I changed my .htaccess file [WORKED FOR ME] :-
我更改了.htaccess文件[适用于我]:-
.htaccess for Live Server :- .htaccess用于Live Server:-
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
.htaccess for Localhost :- .htaccess用于Localhost:-
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.