To stop muslim terrorist organisations, must be supported muslim states where they are gaining ground. Is better to back dictators, and not revolutions in muslim states because dictators prefer stability, and they have a strong political police which won't let terrorist organisations to gain ground.
Now Al-Qaeda, Islamic State and Boko Haram are powerful in states with high instability like Syria, Iraq, Lybia, Yemen, Nigeria, Afghanistan and Mali. It's better with a dictator than with terrorists.
Prevention is always better than cure. Prevention means to help stable regims to fight with all insurgency. Some states are not mature enough to have something better than dictatorship.
Now, the best solution will be to help Kurds with weapons, the only ones who seems to fight against Islamic State.