Fixed PREVIOUS_URL constant not redirecting correctly when previous URL is the homepage