added method to encode route to an URL