Hey everyone,
I am just writing a website for a friend of mine which is relatively simple and involves a product database (with top level categories, subcategories and products). I am using htaccess so as to use URLs such as www.domain.com/categoryname/subcategoryname (as each subcategory can only be in one category). Products however can be in more than one subcategory so i cannot use www.domain.com/categoryname/subcategoryname/productname as the same product will end up having multiple urls.
I have a breadcrumb trail at the top of each page, so if i'm on a product page featuring a chair, which was listed in the subcategory homewares, which is in the category home and garden, then it would have links to Home > Home & Garden > Homewares. The only problem with this is i need to pass the referring subcategory to the product page so it knows what to display in the breadcrumbs. The only ways i can work out to do this are:
1) Don't use friendly URLs and use $GET (obviously not ideal)
2) Use friendly URLs and include the subcat name, but this will cause multiple urls for the same product (obviously not good at all)
3) Use forms with $POST methods containing the subcat whenever linking to the product pages (obviously not good at all as it effectly removes all links to the products from an SEO perspective and makes linking to them in the future much more difficult).
4) Use friendly urls and the QSA htaccess flag to pass the query string (so i end up with something like www.domains.com/products/productname?subcatid=number, which translates the url and passes the subcatid to be got.)
Obviously the best seems to be no.4, as it ensures only one url (from an SEO perspective) for all pages and allows variables to be passed, however from a users point of view we're back to the problems of long, not very nice urls.
From what i can see these are the only options but i wanted to see if i was missing something and if there was a method any of you use in this instance that is cleaner?
Thanks very much for your help guys, i very much look forward to your thoughts,
Dave