I am working on a php project in which I am stuck on the category section. Categories are stored in the database like :
id parent_id category
1 0 MainCatA
2 0 MainCatB
3 0 MainCatC
4 1 ChildCatD
5 4 ChildCatE
6 2 ChildCatF
and so on.
Everything is working fine if someone click on the link like <a href="www.example.com/?cat=3">MainCatC</a>
and obviously URL become www.example.com/?cat=3
and also same for the other. But I need to change the URL pattern like if someone click on the link like <a href="www.example.com/?cat=5">ChildCatE</a>
then the URL will become www.example.com/MainCatA/ChildCatD/ChildCatE like wordpress and magento URL pattern. I need any advice or sample code to achive this URL pattern. I have surf google to get an idea for the same but everywhere suggested htaccess and other stuff which is not understandable. Might be the answer of the question is long for you but I need to know how this works?
any help would be much appreciated.