Abstract In this study, a numerical approach is presented to solve the linear and nonlinear hyperbolic Volterra integrodifferential equations (HVIDEs). The regularization of a Legendre-collocation spectral method is applied for solving HVIDE of the second kind, with the time and space variables on the basis of Legendre-Gauss-Lobatto and Legendre-Gauss (LG) interpolation points, respectively. Concerning bounded domains, the provided HVIDE relation is transformed into three corresponding relations. Hence, a Legendre-collocation spectral approach is applied for solving this equation, and finally, ill-posed linear and nonlinear systems of algebraic equations are obtained; therefore different regularization methods are used to solve them. For an unbounded domain, a suitable mapping to convert the problem on a bounded domain is used and then apply the same proposed method for the bounded domain. For the two cases, the numerical results confirm the exponential convergence rate. The findings of this study are unprecedented for the regularization of the spectral method for the hyperbolic integrodifferential equation. The result in this work seems to be the first successful for the regularization of spectral method for the hyperbolic integrodifferential equation.