As predicted by quantum chromodynamics QCD), at around T similar to 190 MeV in the early Universe, the QCD transition occurs during which the quarks are combined into the massive hadrons. This process reduces the effective relativistic degree of freedom and causes a change in the expansion behavior of the Universe. Similarly, the e(+)e(-) annihilation occurred around T similar to 0. 5 Mev and has the same kind of effect. Besides, the dark energy also drives the present stage accelerating expansion. We study these combined effects on the relic gravitational waves (RGWs). In our treatment, the QCD transition and the e(+)e(-) annihilation are each, respectively, represented by a short period of expansion inserted into the radiation era. Incorporating these effects, the equation of RGWs is analytically solved for a spatially flat universe, evolving from the inflation up to the current acceleration, and the spectrum of RGWs is obtained, covering the who le range of frequency >10(-19) Hz. It is found that the QCD transition causes a reduction of the amplitude of RGWs by similar to 20% in the range > 10(-9) Hz, and the e(+)e(-) annihilation causes a reduction of similar to 10% in the range >10(-12) Hz. In the presence of the dark energy, the combination of the QCD transition and the e(+)e(-) annihilation causes a larger reduction of the amplitude by similar to 30% for the range > 10(-9) Hz, which covers the bands of operation of LIGO and LISA. By analysis, it is shown that RGWs will be difficult to detect by the present LIGO, but can be tested by LISA for certain inflationary models.