The railway line between Coleraine and Londonderry is to close for up to nine months for a £17 million track upgrade.
Passengers will be taken by bus during repair work commencing later this month and finishing in April in time for most of Londonderry's year as UK City of Culture.
It follows safety concerns about the picturesque track. Michael Palin has described the route as one of the most beautiful rail journeys in the world.
Eugene O'Brien, head of track at Northern Ireland Railways, said: "This section of the track passes through some of our most scenic coastline and the completion of this project will allow us to build on this asset, contributing to the economic and social regeneration of the area, particularly during the 2013 UK City of Culture year."
A temporary timetable will operate during the closure from July 29, with bus substitutions in place. All work is planned to take place during sociable hours and the rail company said it would try to keep disturbance to local residents to a minimum.
Two contracts worth £17.3 million were announced for track relays by local companies McLaughlin and Harvey Ltd and McCann BAM Rail. They are part of a total investment of more than £50 million.
The overall engineering project also includes installing new drainage, new ducting for signalling cables, an overhaul of the Bann Bridge and reconstruction of the Pottagh Bridge.
Mr Palin has backed the line upgrade and said it would be very sad if it was diminished during Derry`s year as City of Culture. More than a million people are believed to use the route each year.
Mr O`Brien said: "This project represents a significant investment in the line for the future. Passengers will notice train journeys are smoother and more comfortable, trains will be quieter and the overall performance and safety of the line will be maintained at a high level."
SDLP MLA John Dallat said turning the line into a co-operative may be a long-term solution. He added co-operatives had done well since 2008 despite the economic downturn and local councils could take over ownership. He said the line was run-down and prepared for closure until 2000.