Jbau redirect to preview

(fixes #2393)

this is slightly different than the behavior from @dglance
The differences are the test for public courses and the behavior for logged-in users that are not part of the course (we do not redirect these, @dglance 's patch does)