We report measurements of both the diamagnetic shifts and the linewidths of excitonic transitions in AlxGa1-xAs alloys as a function of Al concentration and magnetic field at 1.4 K using photoluminescence spectroscopy. The magnetic field was varied from 0 to 13 tesla and Al composition in our samples ranged from 0 to 30%. The samples were grown on GaAs substrates oriented along  direction using molecular beam epitaxy at 590°C. We find that for a given value of alloy composition, both the diamagnetic shift and excitonic linewidth increase as a function of magnetic field. To explain our experimental data we propose that the excitons are localized in a very specific manner. To simulate this localization, we assume that the exciton reduced mass is effectively increased and is obtained by using the alloy dependent heavy-hole mass along (001) direction treated isotropically. The calculated values of the variations of the diamagnetic shift and excitonic linewidth as a function of magnetic field obtained using this model agree very well with those reported here.