redirect to proper url if necessary