Welcome Guest, Not a member yet? Register   Sign In
SEO, routing, redirecting without redirecting.
#4

[eluser]mddd[/eluser]
There is a workaround to the 'correct controller name' issue.. you can make routes for all your known controllers and put a 'catchall' after that. Like so:
Code:
$route['cats(:any)'] = 'cats$1';     // 'cats' stays 'cats' and same for 'cats/species/123'
$route['dogs(:any)'] = 'dogs$1';
$route['(:any)'] = 'catchall/$1';    // 'labradors' becomes 'catchall/labradors'

But that means if you add a controller you need to add it to the routes allso. And you have to use a 'skinny controllers' way of programming if you really want to avoid redirecting. The 'catchall' controller needs to be able to handle all of the actions that could occur on all of the controllers.. because you don't know if you're going to end up working on 'cats', 'dogs' or whatever.
So I wouldn't advise doing this. Keeping it in the right controller is much easier. In there, you have the methods you need right at your disposal.


Messages In This Thread
SEO, routing, redirecting without redirecting. - by El Forum - 06-23-2010, 04:04 AM
SEO, routing, redirecting without redirecting. - by El Forum - 06-23-2010, 05:26 AM
SEO, routing, redirecting without redirecting. - by El Forum - 06-23-2010, 05:37 AM
SEO, routing, redirecting without redirecting. - by El Forum - 06-23-2010, 05:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB