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!
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.
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
I was having this issue with CodeIgniter 1.7 when using it through the command line (CLI), but the following could help figure out what is going on. I had to modify the _fetch_uri_string() function in the CI_URI
class (system/libraries/URI.php) to see if $_SERVER['argv'][1]
is set to find the URI being used. To find where your project's URI is present with your global $_SERVER
variable, I would just do a var_dump($_SERVER); exit();
at the top of your index.php file.
Changes I made to the _fetch_uri_string()
function highlighted:
精彩评论