Fix problems with slugs by auto redirect

This fixes #1580 and #1589 by automatically redirecting to a URL without
the post slug if it's detected.

I realise this may not be the optimal solution, but after spending two hours pinpointing and patching all the instances where the slug needs to be accounted for, I gave up. This may, at the least, serve as a temporary fix.