This paper focuses on the study of an optimal control problem for a new spatio-temporal SIR epidemic model with nonlinear density dependent diffusion terms and a class of nonlinear incidence functions. We consider two types of control variables, vaccination for the susceptible and treatment for the infected. For fixed controls, by means of Schauder fixed point theorem, we prove that the proposed model admits a weak biologically feasible solution, the uniqueness of the latter is also investigated. Furthermore, using the state and adjoint problems, first order necessary optimal conditions are obtained. Finally, numerical simulations are carried out for particular diffusion terms incorporating the heard mentality of individuals, when it comes to the spatial movement, and for particular incidence functions, as well as by varying the parameters of the objective functional, to illustrate the possible optimal control strategies and their effect on the studied population.