Welcome Guest, Not a member yet? Register   Sign In
Default Controller not working
#1

[eluser]Drayen[/eluser]
I followed the hello world example and I get the 404 error page when try navigating to

http://userpages.umbc.edu/~username/ci

The config.php file is set properly:

$config['base_url'] = "http://userpages.umbc.edu/~username/ci/";

the routes.php file is set to this:

$route['default_controller'] = "blog";

I tried changing this in the config.php file:

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

Didn't help


http://userpages.umbc.edu/~username/ci/index.php?/blog Works
http://userpages.umbc.edu/~username/ci/index.php/blog Does not work
http://userpages.umbc.edu/~username/ci/ Does not work

So how do I fix this? My teacher grades extremely harshly and will most likely take off all the points for the entire assignment if I can't get the default controller set up properly, so thanks for any help.
#2

[eluser]gtech[/eluser]
with the information you have given me I am unsure of your problem... so here is my setup which works maybe you may get some clues off that. file names and controller names I believe are case sensitive.

why not create a test home controller by cutting and paste the code below and then setting that as your default controller.

C:\xampp\htdocs\ci\system\application\controllers\home.php
Code:
<?php
class Home extends Controller   {
        function Home(){
             parent::Controller();
        }

        function index()
        {    
             echo "test";
        }
}
?>

C:\xampp\htdocs\ci\system\application\config\config.php:
Code:
...
$config['base_url'] = 'http://192.168.2.3/ci/';
...
$config['index_page'] = "index.php"
...

C:\xampp\htdocs\ci\system\application\config\routes.php
Code:
...
$route['default_controller'] = "home";
...

browse to 'http://192.168.2.3/ci/index.php'
or 'http://192.168.2.3/ci/'
displays
Code:
test

if things do not work, maybe you could give us the code of the default controller (use a test one like I have) and tell us what os your running, php version, webserver etc.

[edit after reading post below]My setup is aimed to be as simple as possible and have no need for a htaccess file.

However pbyte has given you 2 links.. 1st shows you how to remove the need to have the index.php in your url when accessing a controller thats not the default controller.. and the second is used to get CI to work on a webserver hosted by dreamhost.. which might be worth a go if the hosting company expects the urls to be a specific format (I must admit I do not know much about this)[/code]
#3

[eluser]Phatbyte[/eluser]
You need to have .htaccess to work that way.

Look
Here or Here
#4

[eluser]Drayen[/eluser]
gtech I tried your solution and I still get a 404 error
Phatebyte, the .htaccess gives me a webserver error when I tried it before after browsing solutions through the wiki

http://www.gl.umbc.edu/web/

^That's the server I'm using
#5

[eluser]gtech[/eluser]
did you change $config['index.php'] = 'index.php?' back to 'index.php' when you tried my example...


lets assume you did then are my assumptions correct?

http://userpages.umbc.edu/~username/ci/index.php?/blog Works (but only if index_page is set to 'index.php?')
http://userpages.umbc.edu/~username/ci/index.php/blog Does not work (even if index_page is set to 'index.php')
http://userpages.umbc.edu/~username/ci/ Does not work (even if index_page is set to 'index.php')

have you tried messing around with the URI protocol in the config.php?
#6

[eluser]Drayen[/eluser]
Yes I changed it back, and your assumptions are partially correct

http://userpages.umbc.edu/~username/ci/index.php?/blog Works whether or not the config is changed to 'index.php?'

http://userpages.umbc.edu/~username/ci/index.php/blog Never works, "no input file specified" error

http://userpages.umbc.edu/~username/ci/ - Never works, 404 error

AH it works, I changed the URL Protocol to QUERY_STRING, thank you for the help
#7

[eluser]gtech[/eluser]
coolarama




Theme © iAndrew 2016 - Forum software by © MyBB