CodeIgniter Forums
Only Default Controller Working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Only Default Controller Working (/showthread.php?tid=64540)



Only Default Controller Working - picotrain - 03-02-2016

Hi,

Only my default controller works. If I comment out my is_logged_in check, my default controller loads. If I do the same with any other controller, they do not work. So if I go to Welcome with log in check disabled, everything is fine. If I do log in check and get redirected to domain/auth/login, 404 page not found.

this is my .htaccess in root folder.Mod_Rewrite works because I do get 500 internal error with mistakes in .htaccess file.

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

My config is:
Code:
$config['base_url'] = 'http://sub.domain.com';
$config['index_page'] = '';
$config['uri_protocol']    = 'REQUEST_URI';

I've tried so many different things and nothing works. I'm at a complete loss.

Thanks for your help in advance.


RE: Only Default Controller Working - keulu - 03-02-2016

and if you do this ?

domain/index.php?/auth/login


RE: Only Default Controller Working - picotrain - 03-02-2016

No dice. That also throws a 404 - page not found error.


RE: Only Default Controller Working - keulu - 03-02-2016

try without your htaccess and specify index.php in your $config['index_page']

if http://sub.domain.com/index.php?/auth/login work, it's your mod_rewrite.

if not, you maybe have a problem with apache or nginx. (can't use htaccess like that with nginx)


RE: Only Default Controller Working - jlp - 03-02-2016

This my be related to the base_url config setting ... there was a change in CI3.0.3, described on the "upgrading" page:
http://www.codeigniter.com/user_guide/installation/upgrade_303.html


RE: Only Default Controller Working - iz_no_good - 03-02-2016

not much info to understand, but i would make sure via apache logs if the URL is the expected one (to verify .htaccess works as expected) and if your controllers are in expected location.

Please keep in mind that first letter has to be uppercase in 3.X and onwards, both in file and in Class name.

is this a new application you are working on, or you upgraded CI and then problem came up?


RE: Only Default Controller Working - picotrain - 03-02-2016

(03-02-2016, 10:04 AM)keulu Wrote: try without your htaccess and specify index.php in your $config['index_page']

if http://sub.domain.com/index.php?/auth/login work, it's your mod_rewrite.

if not, you maybe have a problem with apache or nginx. (can't use htaccess like that with nginx)

Keulu - That doesn't work either unfortunately. Thanks for ideas though.


RE: Only Default Controller Working - picotrain - 03-02-2016

(03-02-2016, 05:17 PM)iz_no_good Wrote: not much info to understand, but i would make sure via apache logs if the URL is the expected one (to verify .htaccess works as expected) and if your controllers are in expected location.

Please keep in mind that first letter has to be uppercase in 3.X and onwards, both in file and in Class name.

is this a new application you are working on, or you upgraded CI and then problem came up?


Controllers are uppercase but filenames were not, I switched to uppercase Auth.php and boom! Works, you are a legend!

Thanks so much!


RE: Only Default Controller Working - picotrain - 03-02-2016

(03-02-2016, 12:54 PM)jlp Wrote: This my be related to the base_url config setting ... there was a change in CI3.0.3, described on the "upgrading" page:
http://www.codeigniter.com/user_guide/in...t=base_url

Thanks for your idea, got solution, see above. Silly me!