Index method is not loading by default on controllers |
Hi everyone,
I have a problem, the index method is not loading by default on any controller (instead, a 404 page is shown), I need to go to localhost/app/exampleController/index to see it. Here my .htaccess file: Code: DirectoryIndex index.php Thank you.
Hi Diederik,
I am using xampp on Windows with 'LoadModule rewrite_module modules/mod_rewrite.so' line uncommented and 'AllowOverride All' set on all occurrences. Here are my config and routes files if it helps: Code: <?php Code: <?php Just for clarification, I have 3 controllers, 'pages' is the main one, the other two are 'users' and 'projects'. I can access to the index method of 'pages' using 'localhost/app/' but I can't access to the index method of 'users' and 'projects' with the url 'localhost/app/users' and 'localhost/app/projects', a 404 page is shown, I need to go to '/index' to see it.
Well this seems to be a routing issue: "$route['(:any)'] = 'pages/$1';" will point all requests to your pages controller. If you request localhost/users it will look for the users method inside your pages controller instead of loading the users model.
https://www.codeigniter.com/userguide3/g...uting.html
The default controller does not accept a directory it should only be the controller name.
This line of code can cause problems sometimes with index method working remark it out and see if that is the case: Code: RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico) What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |