added redirectTo api
added json support for redirect