Welcome Guest, Not a member yet? Register   Sign In
Newb problem
#1

[eluser]MiniMonty[/eluser]
Hi all,

new to CI and seem to be falling at the first hurdle !

I've loaded the CI folders onto the root of my server.
Tested with www.mydomain.com and I see the "Welcome to CodeIgniter!" front page.

So I followed the tutorial to make a new "blog" controller. But when I test with: www.mydomain.com/index.php/blog I get a 404.

I've changed config.php line 14 from http://example.com/ to http://www.mydomain.com/
is there anything else I need to configure ?

Best wishes
Monty
#2

[eluser]Ivar89[/eluser]
so you have this:
Code:
$config['base_url']    = "http://example.com/";

$config['index_page'] = "index.php";
in your config file?

Maybe if you show some of the controller we can actually help...
#3

[eluser]MiniMonty[/eluser]
I have this in my config file:

Code:
$config['base_url']    = "http://www.mydomain.com/";

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

And this in "blog.php" in the controllers folder:

Code:
<?php
class Blog extends Controller {

    function index()
    {
        echo 'Hello World!';
    }
}
?>

as per the example in the user guide.

Best wishes
Monty
#4

[eluser]danmontgomery[/eluser]
Is it an apache 404 or the codeigniter 404?
#5

[eluser]Ivar89[/eluser]
use a lowercase "b" in blog not Blog
don't know if thats the problem but you should always use lowercase.
#6

[eluser]MiniMonty[/eluser]
[quote author="noctrum" date="1276888793"]Is it an apache 404 or the codeigniter 404?[/quote]

It's an Apache 404.

"Not Found

The requested URL /index.php/blog was not found on this server."
#7

[eluser]pickupman[/eluser]
You need to add the class constructor. Try this:
Code:
<?php
class Blog extends Controller {

    function Blog(){
       parent::Controller();
    }

    function index()
    {
        echo 'Hello World!';
    }
}
?>
#8

[eluser]danmontgomery[/eluser]
[quote author="pickupman" date="1276901596"]You need to add the class constructor. [/quote]

This isn't entirely true... As with any other class method if a constructor isn't defined then the parents is inherited.

If it's an apache 404 the request isn't being routed through CI at all, which indicates a problem with the Apache configuration (CI will show it's own 404). Do you have a stray .htaccess, or have you changed anything in httpd.conf?
#9

[eluser]MiniMonty[/eluser]
Quote:Do you have a stray .htaccess, or have you changed anything in httpd.conf?

No .httaccess, haven't changes anything in httpd.conf
I added the class constructor - no joy, still getting "Not Found" etc.,

Pretty stumped by this.
#10

[eluser]pickupman[/eluser]
For sake of diagnosing the issue, can you serve up a standard file like test.html and use www.mydomain.com/test.html, and then try a php file like test.php. Then try www.mydomain.com/test.php. You need to figure out if your server is configured properly. If you are getting a 404 error on those files, you have a problem with your apache configuration. It might be pointing to the wrong folder, or file ownership needs to be to the same group apache is in.




Theme © iAndrew 2016 - Forum software by © MyBB