I am trying to redirect URL's with Codeighiter routing. I could not write routing for the following.
If the URL comes with /api/some/some
I want to redirect it to api/some/some
, otherwise I want to redirect the URL to /home/index
.
i.e if any URL starts with api/
i don't want to change that URL other wise i want to redirect it to default controller home/index
What i tried is mapping the codeigniter URL routing.
$route['api/(:any)'] = 'api/(:any)';
$route['(:any)'] = 'home/index/';
I am trying with codeigniter URL routing technique but i am not able to achieve this.
Is this is the way to redirect URL's at codeigniter level with out touching server side redirection or is there any better approach to do this?