Ensemble density-functional theory (eDFT) suffers from the so-called "ghost interaction" error when approximate exchange-correlation functionals are used. In this work, we present a rigorous ghost interaction correction (GIC) scheme in the context of range-separated eDFT. The method relies on an exact decomposition of the ensemble short-range exchange-correlation energy into a multideterminantal exact exchange term, which involves the long-range interacting ensemble density matrix instead of the Kohn--Sham (KS) one, and a complementary density-functional correlation energy. A generalized adiabatic connection formula is derived for the latter. In order to perform practical calculations, the complementary correlation functional has been simply modeled by its ground-state local density approximation (LDA) while long-range interacting ground- and excited-state wavefunctions have been obtained self-consistently by combining a long-range configuration interaction calculation with a short-range LDA potential. We show that GIC reduces the curvature of approximate range-separated ensemble energies drastically while providing considerably more accurate excitation energies, even for charge-transfer and double excitations. Interestingly, the method performs well also in the context of standard KS-eDFT, which is recovered when the range-separation parameter is set to zero.