Simpanoz
Simpanoz

Reputation: 2859

Codeigniter: how to access controllers in ‘admin’ directory

I have created an admin folder in controllers folder. I have created a controller user in controllers/admin folder.

The following line was added to routes.php:

$route[‘admin/(:any)’] = ‘admin/([a-zA-Z0-9/_]+)’;

The following url is used to access the user controller in controllers/admin folder.

http://localhost/main/forum/admin/user/

My application is routed to default controller and my urls are containing variable like as follows:

http://localhost/main/forum/admin/user/view
http://localhost/main/forum/admin/user/create
http://localhost/main/forum/admin/user/delete/uid/1/uname/my_name
http://localhost/main/forum/admin/dashboard/first_var/2/second_var/3/third_var/4

Thanks in advance.

Also posted on the CodeIgniter forums: Code Igniter forum link

Upvotes: 0

Views: 3114

Answers (1)

Teej
Teej

Reputation: 12873

If you're installation is in the forum directory, then what you are doing is right. In fact, you don't need routes.

Simply going to your_app_installation/admin/user would point to your_app_installation/admin/user.

Upvotes: 2

Related Questions