That code is fine.
The issue was that you had
I've fixed that and the page redirects properly now.
The template.php page didn't have the ecart redirect code on it, which is why the ecart object was showing as broken in the server behaviors window. I've fixed that page as well.