0
votes

In the CodeIgniter manual it demonstrates how to make a controller for blog.php. It says you can point your browser at http://example.com/blog and it will display the echo "hello world"; code in the blog.php file in the controller folder:

When I go to example.com/blog I get a 404 error. I removed the index.php in the url but I think this problem existed prior.

Any help would be great.

1
this is not a problem, this is default URL of CI. - Moyed Ansari
I guess I am confused. In the documentation it says that I can make a controller named blog.php and point my browser to it and have the controller echo "hello world" I understand that its not its function but I just want to make sure it is setup properly. - Tom Schnaars
@Schnaars: Can you successfully access yoursite.com/index.php/blog? Unless you use mod_rewrite and adjust your config.php settings, you must include index.php in the URL. - Colin Brock
yes it is, you can even re-write the url as what you want - Moyed Ansari
Are you literally accessing example.com/blog? Or localhost/blog? Because example.com is an example, you are meant to replace it with your own host name. - meagar

1 Answers

-1
votes

Have you added the blog route to the routes.php file?

http://codeigniter.com/user_guide/general/routing.html

Each URL needs to be mapped to a route so the framework knows which controller to run. It's simple to do, but unfortunately I haven't used CI for some time, and don't have any CI projects with me here to double check where to stick it.

However, the two video tutorials are very good and they'll get you going.

http://codeigniter.com/tutorials/

Have you had anything working with CI so far..?