Codeigniter 3.0.4与404页面未找到我的服务器上的错误 [英] Codeigniter 3.0.4 with 404 Page Not Found Error on my server

查看:1634
本文介绍了Codeigniter 3.0.4与404页面未找到我的服务器上的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是codeigniter的新人。在我的本地主机上开发一个Web应用程序。我上传我的网站在服务器上,然后我导入我的数据库。之后,我已经更改了database.php文件中的数据库的设置..还更改了config.php文件中的基本url。



我遇到了 404网页未找到。
找不到您请求的页面
。我不知道什么是错误..我已经搜索了很多,但没有什么帮助。和我的.htaccess文件是空的..means有没有一行在它。还有一件事是我从 godaddy 托管购买这些东西可能是有用的。



我的routes.php

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

我的控制器doctorscont.php

 <?php defined('BASEPATH')OR exit('No direct script access allowed'); 

class Doctorscont extends CI_Controller {

public function index(){
这里是我的代码..... * /
}
}

和我的配置> config.php

  $ config ['base_url'] =''; 
$ config ['index_page'] ='index.php';

[1]:

方案

您必须在routes.php中定义doctorscont的路线。



请在routes.php结尾处添加此行,然后访问

  $ route ['doctorscont'] ='Doctorscont'; 

如果您仍然收到404错误,请尝试如果它打开,您可能要删除index.php网址。对于此任务,请访问CodeIgniter 网址指南



编辑:



在您的根目录(系统和应用程序的同一文件夹)下创建一个.htaccess文件,内容如下:



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

比打开config.php和编辑行:

  $ config ['index_page'] ='index.php'; 

  $ config ['index_page'] =''; 

现在你可以得到你想要的。


I am new to the codeigniter. After developing a web app on my localhost .So i uploaded my site on server and then i imported my database. after that i have changed the settings of database in database.php file .. and also i changed the base url in config.php file.

I am getting a 404 Page Not Found. The page you requested was not found. I dont know what is going wrong ..i have searched a lot but nothing helps. and my .htaccess file is empty ..means there is not a single line in it. and one more thing is that i purchase this from godaddy hosting may be helpfull.

my routes.php

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

my controller doctorscont.php

<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Doctorscont extends CI_Controller {

   public function index() { 
         here is my code.....  */
   }
}

and my config > config.php

$config['base_url'] = ''; 
$config['index_page'] = 'index.php';

[1]:

解决方案

You have to define doctorscont's route in routes.php.

Please add this line at the end of routes.php then visit

$route['doctorscont'] = 'Doctorscont';

If you still get 404 error, please try If it opens, you may want to remove index.php on URL. For this task, visit CodeIgniter URLs Guide

Edit:

Create a .htaccess file under your root (same folder with system and application) with the content below:

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

Than open config.php and edit this line:

$config['index_page'] = 'index.php';

to this:

$config['index_page'] = '';

Now you can get what you want.

这篇关于Codeigniter 3.0.4与404页面未找到我的服务器上的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆