Default Method in Controller (... index() ... ? ) |
[eluser]beneck[/eluser]
I am having a little bit of trouble accessing a method and I am out of idea. The method is called index() and it's in a Controller called Screen. I can access the file correctly via: http://site/screen/index However, if I do not want to have to put the "index" on there, and I try to access it (assuming the default index() method will be called) by typing http://site/screen I get a bunch of CI errors followed by a 404 Page. Is the index() method called by default if no method is put in the URL? Here is my controller file Code: class Screen extends CI_Controller Here is my .HTACCESS file (perhaps I do not have the property code?) Code: RewriteEngine On
[eluser]InsiteFX[/eluser]
Try this. Code: Options +FollowSymLinks
[eluser]beneck[/eluser]
I appreciate your response! Unfortunately however, that did not work.
[eluser]InsiteFX[/eluser]
I would check your base_url in config.php looks like your paths are messed up some place. It will also depend on what you have done with your index.php file in the config.php
[eluser]beneck[/eluser]
Thank you for your help. Ultimately I think I decided I was just trying to make the index method call without the index method being present in the URL and without having to use the routes file. I just added it to the routes file and it's working fine. I think once the site is closer to being ready to launch I'll write a hook function that looks at the URI and determines if we are in a controller that does not have a method present and then make index the default method. This way if I wanted http://site.com/folder/controller/ Then it would redirect with a hook to folder->controller->index method. Just for FYI... In my config.php file Code: $config['base_url'] = ''; We leave the base_url empty because we have several different programmers from all over the globe working on the site, so they are setting it explicitly in their environment on the index.php file. But I think the correct answer was that I just need to explicitly route the non-index method calling URL internally to call the index method via the routes.php file and then eventually use a hook to fix it to do what I want. Again, your help is appreciated. Thank you. |
Welcome Guest, Not a member yet? Register Sign In |