You would have to go back pretty far to avoid World War l. Stopping the assassination of Ferdinand simply delays it. Let's look at the geopolitical situation.
- France is spoiling for a fight; they want revenge for their humiliating defeat and to take back Alsace and Lorraine. After 1871, a second French/German war is only a matter of time.
- Russia is trying to protest its smaller Slavic brother in the Balkans against Austria. Austria is trying to protect itself from internal unrest in its Slavic provinces. Serbia is trying to exist, while playing Russian roulette (pun intended) with half-hearted attempts at freeing other Austrian-ruled Slavs. So from about 1878 onwards, avoiding war between Austria/Russia is a delicate dance. Neither wants war, but their goals are completely at odds.
- Germany is facing three simultaneous issues.
- It knows that a war with France is inevitable and, as of the 1891 alliance between France and Russia, war with Russia is therefore inevitable as well. German military planners believe that beyond 1920, Russia will have industrialized to the point where there is no way Germany could win. Hindsight leads us to believe they were largely correct. Hence, Germany needs that war with Franc and Russia to happen before 1920 if it has any hope of winning.
- Austria is collapsing, thanks in no small part to Slavic "mischief". Austria-Hungary shares a massive land border with Germany and, should it collapse, will cause Germany to be surrounded on most dies by unfriendly/hostile neighbors.
- As a major industrial nation (beyond France and rivaling Britain/USA at this point) it needs foreign trade. But because of their navies and massive colonial empires, France and especially Britain have a huge chokehold on that trade. Germany often gets the short end of the stick.
- Britain has two very specific goals that is sees as essential for its survival:
- There must always be at least two equal and opposing factions on the European continent. If Europe is fighting itself, it can't invade the British Empire. Britain can not compete with France or Germany should either become dominant on the continent.
- The British Navy must be at least as big as the next two competing navies combined. In this period, that's some combination of France, the USA, and Germany.
So look at all those conflicting needs and ask yourself how you avoid a war.
TLDR
Stopping the killing of Archduke Ferdinand simply delays the war and probably not that much
You can keep Italy out of the war, and maybe Britain. Just keep Germany from invading Belgium and convince the British that whoever wins the war, everyone fighting it will be hammered As long as everyone gets knocked down, the British are fine.
You won't stop a war between France and Germany. You'd have to stop the France-Prussian War for that and the only way that happens is Germany not unifying.
Russia doesn't want war, but if France gets curb-stomped by Germany, it has no friends left. You won't keep Russia out of the war.