Photoluminescence (PL) spectroscopy and x-ray diffraction measurements were employed to study biaxial strain in AlN epilayers grown on different substrates. X-ray diffraction revealed that AlN epilayers grown on AlN bulk substrates (or homoepilayers) have the same lattice parameters as AlN bulk crystals and are almost strain-free. Compared to the free exciton (FX) transition in an AlN homoepilayer, the FX line was 31 meV higher in AlN/sapphire due to a compressive strain and 55 (69) meV lower in AlNSiC (AlNSi) due to a tensile strain. A linear relationship between the FX transition energy peak position and in-plane stress was obtained, and a value of 45 meVGPa for the linear coefficient of the stress-induced bandgap shift in AlN epilayers was deduced. The work here establishes PL as another simple and effective method for monitoring the biaxial stress in AlN epilayers.