Fixing returned URL in PHP script