The answer to the riddle is to ask one of the guards "Would the other guard say your door is correct?" Then if they say "yes" go in the other guard's door, and if they say "yes" go in that guard's door.
I personally prefer asking "Is everything in this statement correct: 'You are standing in front of the safe door below the red sky,'" though. The lying guard says "yes," because both parts of the statement are false and the truthful guard says "no" because the sky isn't red.