![]() |
second controller not accessible - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: second controller not accessible (/showthread.php?tid=59570) |
second controller not accessible - El Forum - 10-21-2013 [eluser]webdevguy32[/eluser] I have main controller. In main, a method (login) calls administer controller. The URL says, mysite/main/login = works fine. Once it logs in, it is redirected to mysite/administer/member. There is a controller in the controller directory called administer and it does have a method called member. The error for that address is: Quote:404 Page Not FoundI can echo out some test code in the main controller just before that redirect so I know the code is getting there. The code is: Code: echo "*****************";exit; Code: redirect('administer/member'); My base url and index file in config are blank. My router are: Code: $route['default_controller'] = "main"; Code: Options +FollowSymLinks Any ideas why it is not able to display anything from the administer controller and how to fix it? Thanks. second controller not accessible - El Forum - 10-21-2013 [eluser]Tpojka[/eluser] Does it work without .htaccess file and with index.php in URL? Edit: Have Code: $this->load->helper('url'); second controller not accessible - El Forum - 10-21-2013 [eluser]webdevguy32[/eluser] I removed the contents of .htaccess, restarted apache, threw up this address mysite/index.php/admin/admin/members and it 404 errors out When I initially added the index.php, I had to log in again and the address was /index.php/main/login_validation When I logged in, it sent me to mysite/main/login_validation (without the index.php) and errors out with "Object not found" second controller not accessible - El Forum - 10-21-2013 [eluser]Tpojka[/eluser] In first post you talked about administer/member, and now you are talking about admin/admin/members? second controller not accessible - El Forum - 10-21-2013 [eluser]webdevguy32[/eluser] You're right, I apo0logize. I changed the names on my end to see if the error was caused by any confusion in my system with the controller name and the folder it's contained in were the same. So I changed the name. The error still exists whatever the name is. Let's continue with it being, admin/admin/members Thanks. second controller not accessible - El Forum - 10-21-2013 [eluser]Tpojka[/eluser] Is that application/controllers/admin/admin.php with method public function members(){}? Can you post code so far? second controller not accessible - El Forum - 10-21-2013 [eluser]webdevguy32[/eluser] No, that url does not post - I have removed the htaccess and tried it with /index.php/controlerfolder/controller/method and it does not work either. I have restarted apache, cleared all browser cache, done everything I know to do. CI works only more than one controller (because I see in example that it mentions that it does, and in subfolders), so it must be something I am doing. I just don't know what I am doing wrong. Thanks. second controller not accessible - El Forum - 10-21-2013 [eluser]Tpojka[/eluser] This is impossible to do this way. Let's try from beginning: 1. Remove .htaccess file (no need of restart server) //config.php file 2. $config['base_url'] = 'http://localhost/codeigniterdirectory/'; //or $config['base_url'] = 'http://yourwebsite.tld/'; 3. $config['index_page'] = 'index.php'; 4. $config['uri_protocol'] = 'AUTO'; 5. Write here your controller code and point where is it located in file system. Maybe than, we could make something second controller not accessible - El Forum - 10-21-2013 [eluser]webdevguy32[/eluser] Okay. The structure is simple: /controller/main.php /controller/admin/administer.php - this has the method "members" these are the urls I've tried and error out 404, with and without the htaccess rewrite on: /index.php/admin/administer/members /admin/administer/members I changed the config file as you specified, still erroring out. Code: <?php Code: <?php second controller not accessible - El Forum - 10-21-2013 [eluser]Tpojka[/eluser] If code bellow one is administer.php file, It need to have Code: class Administer extends CI_Controller { /*code*/ } |