CodeIgniter Forums
HMVC route module to root - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: HMVC route module to root (/thread-20351.html)



HMVC route module to root - El Forum - 07-07-2009

[eluser]CoffeeBeanDesign[/eluser]
Hi guys,

I'd like to use a particular module at the website root. So this is my folder layout :

modules

- public
- controllers
- gallery.php
- contact.php
- models
- views

- backend
- controllers
- models
- views

Currently I can use www.domain.com/public/* and www.domain.com/backend/* I want www.domain.com/gallery and www.domain.com/contact to automatically route to the public module controllers. This is probably either a really easy .htaccess or routes.php solution but I can't find the answer. I guess it's a 'divert anything other than backend to public' redirect.

Your help is greatly appreciated.


HMVC route module to root - El Forum - 07-07-2009

[eluser]Evil Wizard[/eluser]
Code:
$route['contact/(:any)'] = "public/contact/$1"
$route['gallery/(:any)'] = "public/gallery/$1"
in the routes.php file should do it Wink