How do you redirect the rockets at GLaDOS in Portal?

Quick answer: Put a portal on the floor under GLaDOS, let the rocket turret lock on to you, then place the other portal in the rocket’s path and step aside. The rocket flies through and hits her.
Show walkthrough (story spoilers)
When the turret appears
The rocket turret wakes up after you burn the first core. It tracks you with a red laser and fires a slow rocket when it locks on. A rocket that hits you directly hurts a lot, so do not stand still in the open.
Set up the portals
Place one portal on the floor or a surface under GLaDOS so a rocket coming out of it flies straight up into her. Then stand where the turret can see you, with a wall or floor between you and it where you can put the second portal.
Bait the rocket
Let the turret’s laser lock on to you. Right after it fires, place the second portal in the rocket’s path and move out of the way. The rocket comes out of the first portal and hits GLaDOS.
After each hit
Each hit knocks a personality core loose. Grab it and burn it in the incinerator before you set up the next shot. Repeat the same trick for every core.
