CodeIgniter Forums
Routing question - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: Routing question (/thread-50721.html)

Routing question - El Forum - 04-05-2012

I am about to start writing a new site that is bringing together several other sites under one roof. All of these sites are community sharing sites that will be using the same code but I want to keep them separate entities having URLs like:

I have read the routing help file but I'm not too sure how (or if) this is possible, and with the above URL pass the community_site_name to the controller so that I can then use it in the queries etc.

If anyone could advise. Also, if anyone has another suggestion to do this then I'm open to changing my approach.



Routing question - El Forum - 04-05-2012

Well, I take it you want the community_site_name to be the first parameter in front of any of the other parameters such as anything and else. Assuming you want to rearrange the URL as such:


then you could use the following basic routing mechanism:
$route['(:any)/(:any)/(:any)/(:any)'] = '$2/$3/$1/$4';
This route will perform the rearrangement above.