CodeIgniter Forums
Problems with controllers - New to CI - 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: Problems with controllers - New to CI (/showthread.php?tid=23653)



Problems with controllers - New to CI - El Forum - 10-18-2009

[eluser]andriu[/eluser]
Hi everyone.

I'm new to CI and I'm trying to build my first application with it.
And I would be grateful for some help with controllers.

Tried to search trough guide and forums.

Problem: I'm trying to redirect to login.php if user is not logged on and it show up with 404.

files:
controllers/admin.php
controllers/admin/some_page.php
controllers/admin/login.php

url: example.com/admin
redirects if user not logged in:
redirect(admin/login);

but it shows up with a 404.


I would prefer to delete admin.php but I don't know how to load some_page and check if user is logged in.

So how do i set a default controller within a subfolder??


Any help would be appreciated.


Problems with controllers - New to CI - El Forum - 10-18-2009

[eluser]andriu[/eluser]
Nevermind, Problem solved

Discovered if I delete admin.php and rename
some_page.php to welcome.php it works fine.

Didn't realize default controller goes for controller subfolder as well.