Welcome Guest, Not a member yet? Register   Sign In
Basic startup
#1

[eluser]bastiat[/eluser]
Following a tutorial.
I have now created a model.
The controller is
Code:
<?php
        class Members extends Controller {
                function Members(){
                        parent::Controller();
                }

                function Test(){
                        echo "Hi";
                }
        }
?>

Why would I get the "Not Found" Apache Error Page instead of the CodeIgniter 404 page?

The requested URL /nettuts/members/test was not found on this server.
The welcome.php shows up fine
.htaccess is configured like in the CodeIgniter docs.
#2

[eluser]JamieBarton[/eluser]
You say model and controller, which have you created? What's the file name?
#3

[eluser]oldmatt[/eluser]
If you are using CI 2.0 you should extend the CI_Controller instead of the Controller (if I remember correctly)
#4

[eluser]InsiteFX[/eluser]
CI 2.0 changes Controller is now CI_Controller and Model is now CI_Model

Controller for CI 2.0
Code:
<?php
class Members extends CI_Controller {

    public function __construct()
    {
        parent::__construct();
    }

    function index()
    {
        echo "Hi";
    }

}

Also do not use the bottom closing php tag ?>

The default method for a Controller is index not Test.

CI 2.0 Model
Code:
class Model_name extends CI_Model {

    public function __construct()
    {
        parent::__construct();
    }

}

InsiteFX
#5

[eluser]bastiat[/eluser]
I scrapped all of that, since the tutorial is probably old.
I went to the CodeIgniter tutorial and still the same problem.

Hello World! Introduction to CodeIgniter
Code:
<?php
        class Blog extends Controller {
                function index() {
                        echo 'Hellow World';
                }
        }

Still have the same problem:
"Not Found

The requested URL /nettuts/blog was not found on this server."

Could I have done something wrong in the configuration or .htaccess?
#6

[eluser]Rick Jolly[/eluser]
Read.
#7

[eluser]oldmatt[/eluser]
There really wasn't a need to re-create anything. Since the correct code has been posted above for you. All you need to do is copy and paste it. Wink
#8

[eluser]bastiat[/eluser]
[quote author="oldmatt" date="1299891686"]There really wasn't a need to re-create anything. Since the correct code has been posted above for you. All you need to do is copy and paste it. Wink[/quote]

Actually I had to scrap it since the tutorial I'm following may
be a red herring.

So instead I followed the CodeIgniter intro tutorial.

Guess what?

Still FAIL!

So what else can I look at to deduce the source of the breakdown?
#9

[eluser]deth4uall[/eluser]
Find a file on your server called .htaccess, open it and paste this code in the top of it before saving and uploading the altered file. Wink It should be placed in the root folder of your CodeIgniter installation. Anywhere else will cause problems for ya that ye don't want.
Code:
RewriteEngine On
Options FollowSymLinks
RewriteBase /


RewriteRule ^error/(.*)$ index.php?/main/index/$1 [L]

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
  
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
#10

[eluser]bastiat[/eluser]
Thanks for the .htaccess info, but that doesn't help either.
WTF?!

The welcome page comes up fine, but still nothing with the blog.php tutorial.




Theme © iAndrew 2016 - Forum software by © MyBB