move redirect script to head so its called before the DOM is loaded