Prevented Invalid URLs from being used in JS and Meta redirects

Tracker item http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=30354