good_boy1 — 2013-06-29T14:31:54-04:00 — #1
I have a website that has a changing url to be rewritten according to the name of the product or a navigation name.
I have to distinguish between navigation names and product names that have to be redirected to two diffrent pages.
Lets say that one of my navigations is 'Beautiful flowers'. Then that would be redirected as www.exp.com/beautiful-flowers/ to navigation.php.
But i also have product names that has to be distinguished like that but they can change beacuse the customer gives names to products with cms.
It could be 'Red Rose' or 'Beautiful Desert Red Rose' or just 'Rose' and that product has to be redirected to products.php.
I guess my question is, what would be the pattern that would search a string with unknown number of hyphens?
Thank you in advance
jeff_mott — 2013-06-29T17:24:59-04:00 — #2
So, to clarify, are you saying that navigation names and product names are both represented the same way? That is,
good_boy1 — 2013-06-30T02:08:07-04:00 — #3
yes, but the product name can vary with the number of word it can hold but the navigation names are constants. I made
a temp solution with (nav-name1|nav-name2| etc... but thats awful. i know theres a better solution.
jeff_mott — 2013-06-30T02:23:27-04:00 — #4
There might not be. What you have here is essentially a namespace clash.
It sounds like you have a fixed number of constant navigation names, and an indefinite number of variable product names. Given that, I would resolve this namespace clash by deciding that navigation names take precedence. Check for the known navigation names first, and rewrite to navigation.php as appropriate. Or if none of the navigation names matched, then assume it's a product name and rewrite to products.php.
good_boy1 — 2013-06-30T03:06:09-04:00 — #5
i have done that already but i thought there is a better solution.
Many thanks for the info