Tutorial :Codeigniter only loads the default controller



Question:

I'm writing some software at the moment and using CI for the first time with it.

The default controller is set to the first controller I want to action call 'login' (the controller is login.php, the view is login.php. When the form is submitted it calls the 'authenticate' controller. This executes fine, process the login data correctly and then does a redirect command (without any output to the screen prior) to the next page in this case 'newspage'. The problem is that the redirect, never reaches 'newspage' but the default controller runs again.

It doesn't matter what I put ... http://yourname.xyz/anything ... (yes i'm using .htaccess to remove the index.php) the anything never gets called, just the default controller. I have left the standard 'welcome.php' controller and 'welcome_message.php' in the folders and even putting http://yourname.xyz/welcome all I get is the login screen!


Solution:1

Try changing $config['uri_protocol'] to each of the possible values listed in the config.php file. One of them may well get it working, as this is a common issue.


Solution:2

I had this same problem and none of the questions here could help me, as it turned out I set the default controller in my index.php file when I should have set it in my config/routes.php file


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »