For sustainable forest management, understanding the ecological factors that determine vegetation composition are important. Here, the relation between the vegetation composition and environmental factors (elevation, aspect, slope, CaCO3, K, P, C, N, C/N, bulk density, soil porosity, saturation moisture content, EC, pH, sand, silt and clay) was investigated in the Khonj forests, Fars Province, Iran. Characteristic land units, each 200 m2, were chosen for sampling to analyze species composition, soil characteristics and topographic factors. The floristic data were classified using a two-way indicator species analysis (TWINSPAN). Means were then compared using an ANOVA and Duncan multiple range test to detect any variations between groups. Also, the Kaiser–Meyer–Olkin index and Bartlett test were used to measure sampling adequacy. The four vegetation groups identified comprised the species Achillea wilhelmsii, Tanacetum parthenium, Convolvulus spinosus, Capparis spinosa. A detrended canonical correspondence analysis (DCCA) ordination diagram clearly illustrated the relationship between vegetation and environmental factors. According to the results, group 1 with A. wilhelmsii as the indicator species has a positive relation with slope and elevation. T. parthenium was the indicator species of group 2, that appears in areas with high silt and low bulk density and sand. The results showed that group 3 with Convolvulus spinosus as the indicator species was distributed in soils with high bulk density, low silt and pH as well. Group 4 with C. spinosa as the indicator species occurs in sandy soils and low slopes. Using DCCA, we determined the relationship between species and environmental factors more accurately. Results of this study can be used to restore vegetation or maintain species composition in ecological sensitive areas.