added ensure_canonical_url

cleaner way of doing the 301 redirects I suggested before.