• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Default controller takes all traffic, even when new controllers / views are defined.

Greetings all,

I'm not entirely new to PHP, but only began playing with CI about a week ago. I watched the tutorials and get MVC conceptually. Now I've modified my routes to use a newly created default controller, and that works great.

However, when I create a new controller, "Mylinks", the default controller/view is all I see. That is, when I go to http://www.mysite.com/index.php/mylinks, I see the same thing as if I were to have left off the "/mylinks" part of the URI. New controller looks like this:


class Mylinks extends Controller {

    function Mylinks() {
    function index() {


The mylinks_view.php file is very simple -- just an HTML hello world. Am I doing something wrong that's making the default controller respond where it shouldn't?

Also, though I'm not sure it's related, the only other change I made to my CI config was to my config.php file:

$config['uri_protocol']    = "QUERY_STRING";

Many thanks.

Hmmm, well, I switched my config.php file back to the default of:

$config['uri_protocol']    = "AUTO";

And now, it works as expected. HOWEVER, the reason I switched it away from "AUTO" in the first place now comes back. When I enter the following URI, I get a 404:

Similarly, if I simply enter

I also get a 404 page.

When I add a "/" to the end of the URI, things work great. The only thing I could find presenting a fix for this was to switch my 'uri_protocol' configuration to "QUERY_STRING" as noted in the original post. Any suggestions on how to resolve the need for a trailing slash, and still have my new controller methods recognized??

Again, thanks for any help.

I fixed the issue somehow.
* Added the .htaccess rule to remove index.php from uri
* Removed index.php in line => $config[‘index_page’] = “”;
* Changed uri protocol to => $config[‘uri_protocol’] = “REQUEST_URI”;

May be you could try this!


Works perfectly now. Many thanks.

Heads up to anyone using 1&1 (1and1.com) for hosting... running PHP version 4.4.9.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.