bugfix #123; resolve http redirects in REST.php

Please pull this bugfix. It solves a fest REST related problems described in bug #123 as well as a http-redirect Problem. Thank you.