I would like to redirect this /dokument/produktblad/:product_code.pdf where :product_code is something like ABC-123 to https://partnerzon.specialelektronik.se/redirect/product/:product_code
It’s possible if there exists a HTML page at https://partnerzon.specialelektronik.se/redirect/product/ABC-123. If you’re just looking to hide .pdf extension, then it’s not possible. You’d have to generate a HTML page which will embed the PDF in it or something of that sort.
I don’t believe you can do what you’re looking to do directly in a _redirect but you absolutely can redirect (or ‘rewrite’ as we call it when you use a 200 status) to a Function that you write, which would return a 302 (or 301 if you prefer) to the un-.pdf'd location. Effectively encoding some kind of logic like:
but you will need to be careful about how redirect/rewrite shadowing works since you’re going to be redirecting into the same directory that the * splat targets. Check out these docs for more info, but hopefully this gives you a place to start.