How do I write a redirect to catch the potentially hundreds of pages this could appear on, I tried using my usual redirect code with a wild card but this didn't fly.
The bigger problem I am facing? I need to keep the page on the product .html url ie. blue-product.html so ideally I cannot rewrite the urls to blue-product/foo/bar/ because of some external factors. I can get away with a different url as long as it ends with blue-product.html however so the target url may be something like;
If the parameter-name used in the internal query-based filepath is always "foo," then there may be no need to include it in the 'friendly' URL. So perhaps you can use only http://www.example.com/bar/blue-product.html
Be aware that any objects included on the "blue-product.html" page must be referenced using server-relative links or absolute URLs. If such objects are referred to as page-relative links, the browser will request them from a subdirectory named "/foo/bar" and this will likely return a 404 error. So use <img src="/images/logo.gif"> or <img src="http://example.com/images/logo.gif"> instead of trying to use <img src="images/logo.gif"> or <img src="../images/logo.gif">
I think I may go down the much easier route of modifying the stupid cms so it doesn't actually generate these URLs, I wouldn't care so much but Google seems to do it's best to index them despite me telling it to ignore them