In this work, the AlxGa1-xN-on-sapphire template was successfully prepared by halide vapor phase epitaxy (HVPE) at 1100°C. The flow ratio (R) of the HCl flow rate through Al metal to the total HCl flow rates through Al and Ga metals was adjusted to control the Al content. The AlxGa1-xN films without phase separation can be obtained as the R value exceeds 0.67. The low R value strongly enhances the formation probability of GaN instead of AlxGa1-xN. This indicates that a sufficient concentration of the Al precursor is certainly vital for the formation of AlxGa1-xN compounds. The AlxGa1-xN prepared at the R value of 0.80 can achieve best crystallinity and the lowest surface roughness. Furthermore, the optical transmittance of the AlxGa1-xN under R=0.80 is above 70% between the wavelength of 225 nm and 400 nm. As a result, the AlxGa1-xN under R=0.80 can be regarded as a suitable growth template for the ultraviolet light-emitting diodes. The internal quantum efficiency of the 370 nm-quantum wells on the AlxGa1-xN/sapphire prepared under R=0.80 shows 127% improvement as compared with that on the undoped-GaN/sapphire.