Fix url redirect to work for any window location origin