The Wilts, Somerset and Weymouth Railway was completed from near Chippenham, via Melksham and Trowbridge, as far as Westbury in 1848. That company was bought by the Great Western Railway in 1850, who over the next few years built lines onwards to Frome (to access the Somerset coalfield), then south to Yeovil and Weymouth, as well as southeast from Westbury to Warminster and then Salisbury. Westbury station was rebuilt in 1899 since it would become more important as a junction the next year, on the opening of the Stert and Westbury line. This was a faster route from London to Weymouth, which at Westbury crossed the route between the south coast and Bristol or South Wales. From 1906 the route from London was also used by trains to Taunton and Exeter.