This issue is pretty close to my heart, as I once had some minor back pain which was caused namely by tight hamstrings. And I felt the same way you do, that the straight leg, lean forward stretch wasn't cutting it.
Static stretches
Static stretches is something you usually do after the workout because as you perform contraction after contraction during your workout, your muscles are left in a shortened state. Stretching helps to reset your body to a natural position and posture.
Some static stretches that changed my game were ones where you lie down. I think a picture says a thousand words (but takes less space) so here are the two that I started doing, and am doing after every workout to this day.


I predominantly do the first one, using simply my hand to pull, but I do the rubber band one every now and then for variety.
Dynamic stretches
This is what I like to do before the workout, because it involves movement, getting warm, and getting blood into the muscles before heading for the racks.
I only do one for hamstrings, as depicted below. This is a very nice movement to do in between your warmup sets to loosen up while staying warm.
