One of the important properties of the solutions of Maxwell equations is the conservation of the electric and magnetic charges. But, these charge conservation laws may not be strictly obeyed by numerical solutions of Maxwell equations, due to the presence of various types of numerical errors. The violation of the conservation laws is a consequence of the broken gauge symmetry in the computational space, which can be recovered by an introduction of the physically consistent counter terms. In this paper, we present a new numerical scheme for the correction of the divergence errors for Maxwell- and MHD equations, which is consistent with the symmetries of Maxwell theory, namely the Lorentz-, gauge- and duality symmetries. The central idea of our divergence correction scheme is the implementation of the physically consistent counter term Ansätze to Maxwell and MHD equations, for the restoration of the gauge symmetry. One of the main advantages of our method is that the divergence conditions for the charge conservations are implemented into the Maxwell and MHD equations in a hyperbolic form, rather than the genuine elliptic form, and it can be easily implemented into the existing codes for Maxwell and MHD solvers via operator splitting Ansatz.