0

This code is working on my local Lamp(Windows) but not on the Server.

Controller:

      public function home() { 

     $this->load->view('my_view'); // load view my_view.php
  } 

Route:

$route['default_controller'] = "my_controller/home"; // index page

Any ideas what else needs to be done for it to work on the server? PS: I can´t change "httpd.conf" file.

Carlos R
  • 205
  • 2
  • 12
  • 1
    Your route variable is not containing a controller name only, but a controller and method name. Try changing to: $route['default_controller'] = 'my_controller'; – Michael Krikorev Feb 12 '17 at 14:58
  • Then.. if you want a redirect to home() method, put this in your controller: public function index() { redirect('my_controller/home/'); } – Michael Krikorev Feb 12 '17 at 15:02
  • Capitalize M in my_controller both file name and Class name – Geordy James Feb 12 '17 at 15:21
  • Check the directory and file permission. `chmod -R 0644 application system index.php` Also check this answer [http://stackoverflow.com/questions/3752609/codeigniter-404-page-not-found-but-why] – abdul rashid Feb 12 '17 at 15:24
  • Thanks all for the comments. I first tried to correct the permission. Then I read the proposed link, and nothing helped. I also tried to capitalize the controller even thou this did not make any sense to me. The problem was fixed by capitalizing the controller. Can you explain why? just for understanding...Post it as an answer plz. – Carlos R Feb 12 '17 at 19:36
  • Codeigniter default controller cannot be in sub folder unless you extend the routes https://github.com/wolfgang1983/CI3-default_controller_route_with_sub_folder –  Feb 12 '17 at 20:45
  • Default controller was extended, but with lower case name. That did not worked on this server. I had to rename it with the first letter a capital letter, for it to work. – Carlos R Feb 12 '17 at 20:55

1 Answers1

1

The problem was fixed by capitalizing the controller.

Carlos R
  • 205
  • 2
  • 12