For primary and secondary alcohol you can try the below method.
1.Take the alcohol in inert solvent(like toluene,THF) in anhydrous condition.
2.Add appropriate base(To scavenge liberated Hcl) more than 1.0eq. and add the TsCl/MsCl (low temperature is preferred over high temperature).
3.In general sulfonate esters are stable under the absence of any nucleophiles.