We developed a novel direct optimization method to solve distributed optimal control of viscous Burgers' equation over a finite-time horizon by minimizing the distance between the state function and a desired target state profile along with the energy of the control. Through a novel linearization strategy, well-conditioned integral reformulations, optimal Gegenbauer barycentric quadratures, and nodal discontinuous Galerkin discretizations, the method reduces such optimal control problems into finite-dimensional, nonlinear programming problems subject to linear algebraic system of equations and discrete mixed path inequality constraints that can be solved easily using standard optimization software. The proposed method produces "an auxiliary control function" that provides a useful model to explicitly define the optimal controller of the state variable. We present an error analysis of the semidiscretization and full discretization of the weak form of the reduced equality constraint system equations to demonstrate the exponential convergence of the method. The accuracy of the proposed method is examined using two numerical examples for various target state functions in the existence/absence of control bounds. The proposed method is exponentially convergent in both space and time, thus producing highly accurate approximations using a significantly small number of collocation points.