GRB 070311: a direct link between the prompt emission and the afterglow