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
So, to clarify, are you saying that navigation names and product names are both represented the same way? That is,
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.
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.
i have done that already but i thought there is a better solution.
Many thanks for the info
This topic is now closed. New replies are no longer allowed.