Welcome Guest, Not a member yet? Register   Sign In
Routes question
#1

[eluser]btray77[/eluser]
Quick question involving routes and CI. I'm updating an existing website with the following URL structure.

Code:
website.com/<single letter><number>
example: website.com/p213423423 or website.com/i23432 These are individual product pages. These might end up having to have letters and not just numbers in the future.

Code:
website.com/<main>/<sub>/<type>/<page>

example: website.com/state/city/restaurants/2 (All State/City Information is generated out of a database) These are lists of products pages

Code:
website.com/articles/<Article Title>/<page>
example: website.com/articles/How_To_Buy_A_Boat/3

Code:
website.com/search/<parameters separated by slash>
example: website.com/search/dog/price_0_100/zipcode_96817/ETC........

Code:
website.com/admin/<etc...>
example: website.com/admin/add/page or website.com/admin/


How would you setup the routes with a setup like this?

I've got the following:

Code:
$route['([a-z])(:num)'] = 'getsinglelisting';
$route['search/(:any)'] = 'search';
$route['articles/(:any)'] = 'articles';
$route['articles'] = 'articles';  
$route['admin/(:any)'] = 'admin/admin';
$route['admin'] = 'admin/admin';
$route['(:any)/(:any)/(:any)/(:any)'] = 'find';  //  State City Type And Page
$route['(:any)/(:any)/(:any)'] = 'find'; //  State City And Type OR State City Page
$route['(:any)/(:any)'] = 'find';  //  State And City OR State Page
$route['(:any)'] = 'find';  //  State


Note sure if this is the "best" way to handle it.


Thanks

-Brad




Theme © iAndrew 2016 - Forum software by © MyBB