CodeIgniter Forums

Full Version: HMVC - 404 error with routes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Kijer[/eluser]
Hi,

in first, i'm sorry if my english is bad, i'm french and i do that i can.

i've a problem, i explain :

for my administration, i've admin.php with this routes :

Code:
$route['admin/([a-zA-Z_-]+)/(:any)'] = '$1/admin/$2';
$route['admin/([a-zA-Z_-]+)'] = '$1/admin/index';

in /modules/module_name/admin.php

all is ok for that..


now...

I want :

/admin/annonces/gestion.html with a different controller than admin.php (admin_gestion.php)

i've tried (in root/routes.php or config folder of modules)

Code:
$route['admin/([a-zA-Z_-]+)/gestion/(:any)'] = '$1/admin_gestion/$2';
OR
$route['admin/annonces/gestion/(:any)'] = 'admin_gestion/$2';

fail. always 404, because i think, it search in controller annonces and method "gestion"

no ?

How i can do that ?

Thx.

El Forum

[eluser]Kijer[/eluser]
it seems that i solved my problem with this routes.php (in config module)

Code:
$route['annonces/admin/gestion(/:any)?'] = 'admin_gestion$1';

But i understand anything... my URI is admin/categories/gestion.html , so why is inversed in routes.php ?

please explain me..

El Forum

[eluser]Kristories[/eluser]
Try this..
Code:
$admin       = 'custom_admin';
$route[$admin]      = 'home/admin';
$route[$admin.'/([a-zA-Z0-9]+)']   = '$1/admin/index';
$route[$admin.'/([a-zA-Z0-9]+)/(:any)']  = '$1/admin/$2';
$route[$admin.'/login']    = 'auth/admin/login';
$route[$admin.'/logout']    = 'auth/admin/logout';

Just call http://yours.com/custom_admin/controller/method