How to prevent phlebitis?

Health & movement. Avoid obesity, tobacco, and standing or sitting immobile for more than a couple of hours. It 'trapped', such as when flying, pump your calf muscles by contracting and relaxing them a few minutes every hour or two and/or take a walk down the aisle. Compression stockings may be helpful, particularly for specific risks such as varicose veins. It is uncertain if there is any benefit from aspirin.
Treatment. If you have superficial venous reflux then you should have treatment for this. You can have an ultrasound to find out.
All are right. Don't smoke. Maintain healthy weight. Exercise. Avoid drugs that increase risk. Use graduated compression stockings. If you have varicose veins, get them treated. Elevate legs when possible. Stay well hydrated.
Lifestyle changes. Don't smoke. Exercise regularly. Avoid direct muscle injury to legs. Elevate legs and minimize salt intake to avoid swelling. Maintain low blood pressure.