Welcome Guest, Not a member yet? Register   Sign In
“404 Page Not Found” errors.

I am new in CI. Don’t understand what is wrong in my code. I am getting “404 Page Not Found” errors.

My Config file is as bellow.

[controller > pri.php]
class Pri extends Controller {
function Pri()
function index()
function pc()

[views > view_ex.php]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;


[config > config.php]
$config['base_url'] = "http://www.xyz.us/";
$config['index_page'] = "index.php";

[Config > routes.php]
$route['default_controller'] = "pri";
$route['scaffolding_trigger'] = "";

But It always return CI 404 error from my given URL: http://www.xyz.us/index.php/pri/pc/

Plz help ....

Have you edited your .htaccess file?
If you have set this to hide the index.php from the url, you should access your controller with: http://www.xyz.us/pri/pc/

If you haven't edited this file, then you gotta check if the file is named correctly.

That is puzzling. With a quick glance things look good to me. What is your file structure? Where does your virtualhost DocumentRoot point to? Do you get the index method of the pri controller when you simply use http://www.xyz.us/ ? Do you have DirectoryIndex set to index.php? Are you using an htaccess file or an apache config file (assuming you use apache) with mod rewrite?

Thanks for the response ..

The mentioned code worked perfect on my localhost.. But it returns CI 404 error on my Linux based web server.
I did not use any .htacess file.

N.B: The index URL (http://www.xyz.us/index.php) works perfect both on my localhost and webserver.

Please help ...

Just a guess as I can't remember the actual error I was getting when trying to start out, but are the versions of PHP different on your localhost as opposed to your live Linux box? PHP5 (the version mostly seeming to be installed on Linux boxes nowadays) require this to be at the start of your Controller instead of the class name:

class Pri extends Controller {
    function __construct()
    // continue on with the rest of the controller code...

Theme © iAndrew 2016 - Forum software by © MyBB