Welcome Guest, Not a member yet? Register   Sign In
1 Level URL Question
#1

[eluser]Unknown[/eluser]
Hi Guys,

I am still fresh with CodeIgniter, I have been wondering and searching about the urls and still could not find the answer.

Would it be possible to have every urls in 1 level. such as

so instead of:

http://www.test.com/category
- http://www.test.com/category/bikes
- http://www.test.com/category/cars

http://www.test.com/brand
- http://www.test.com/brand/toyota
- http://www.test.com/brand/honda

I will have:

http://www.test.com/category
- http://www.test.com/bikes
- http://www.test.com/cars

http://www.test.com/brand
- http://www.test.com/toyota
- http://www.test.com/honda

Thank you. Smile
#2

[eluser]WanWizard[/eluser]
You can do that with routes, but it would require an awful lot of routes, created manually for every category and brand.

Maybe it's better to use a 'detection controller', that checks if the first segment is a category or a brand, and redirect to the correct controller.
If you use an HMVC solution, you could opt to call the correct controller directly instead of redirecting, which will preserve the URL, but is a 3rd-party solution.




Theme © iAndrew 2016 - Forum software by © MyBB