I've been scratching my head about this one for a while. I have tried to add a hook within WP_Rewrite to ensure that we can pick up pages with a similar structure:
/products/product1-with-*
/products/product2-with-*
The actual page, would be /products/product1. The end result would be that the * would be used in the page (once processed) to transform it or change the theme etc.
It seems that the following is available in WordPress:
add_rewrite_endpoint: This seems to do what I want, but without the URL format I am after. This would yield something like/with/*which is not what I want ideally.adding a new route: This seems overkill for what I need, ideally I don't want to modify/create multiple routes just to tranform the existing ones.
I have also tried a few of the normal filters such as parse_query and pre_get_posts but it seems most of the work of deciding what page to display has been decided at these points.
Is there a relatively simple way to parse the URL when requested and strip out the with-* part until needed within the page?
If not, how would it be accomplished with the new route method?