When Pharaoh let the people leave, God did not lead them along the Philistine Highway, although it was the shorter route. God's consideration was that if the people encountered armed resistance, they would lose heart and return to Egypt.
Vayehi beshalach Par'oh et-ha'am velo-nacham Elohim derech erets Plishtim ki karov hu ki amar Elohim pen-yinachem ha'am bir'otam milchamah veshavu Mitsraymah.
Literally, 'Way of the land of the Philistines.' Josephus refers to this as the 'Palestine Highway' (Antiquities 2:15:3). This is the usual route to Egypt, along the Mediterranean coast through Philistine territory (cf. Herodotus 3:5). There was an ancient enmity between the Israelites and the Philistines (Targum Yonathan; Mekhilta; Rashi; Josephus 2:15:3). See Genesis 10:14, 21:32, 26:14; 1 Chronicles 7:21, Targum ad loc..