Using Codeigniter, I have a controller function name search that takes in parameters state and city in the URI segments http://www.mysite.com/functionA/MA/Boston/0 where 0 is used by the pagination class. The controller function declaration will thus look like:
function search(state, city) {
...
}
Problem: For SEO purposes and to get pretty URLs, I want http://www.mysite.com/search/MA/Boston/view/12345 to show a particular page for product id 12345. In this case, View is our second controller function defined by
function view(pid) {
...
}
And the first controller function search does not do anything in this case, its there in the URL just to make the URL pretty etc. So view is the only working controller function.
How can I achieve this?
URI Routing
http://ellislab.com/codeigniter/user_guide/general/routing.html
Something like this mayhaps?
This gets any URI that looks like
search/something/whatever/view/325and reroutes it toview/325