Welcome Guest, Not a member yet? Register   Sign In
mod_rewrite changing URI segment order
#4

[eluser]Aken[/eluser]
1) Set up a route that basically tells CodeIgniter to ignore the first segment, along with a route that makes sure if only the website name exists, it loads the homepage controller.

Code:
$route['[a-zA-Z0-9\-\.]+/(:any)'] = '$1'; // Add any potential characters that will be in the website segment.
$route['[a-zA-Z0-9\-\.]+'] = 'home'; // Whatever your site's index controller is.

2) Use a base controller (also known as MY_Controller) to get the first URI segment, and use that to figure out what website is viewed and do any appropriate logic. This allows you to use method parameters as normal. All your other controllers will then extend MY_Controller instead of CI_Controller.

Give that a shot and let us know if you run into any specific problems.


Messages In This Thread
mod_rewrite changing URI segment order - by El Forum - 07-03-2012, 10:26 PM
mod_rewrite changing URI segment order - by El Forum - 07-03-2012, 11:36 PM
mod_rewrite changing URI segment order - by El Forum - 07-04-2012, 09:51 AM
mod_rewrite changing URI segment order - by El Forum - 07-04-2012, 10:24 PM
mod_rewrite changing URI segment order - by El Forum - 07-05-2012, 10:16 AM
mod_rewrite changing URI segment order - by El Forum - 07-05-2012, 11:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB