Hurst Lane in Auckley will be closed for three to five weeks from next week while Yorkshire Water relocate a water mains pipe.
A short section of pipe on either side of the railway bridge will be diverted to facilitate Network Rail plans to improve the bridge.
The new route will go through fields and playing fields before rejoining the old pipe.
Local Coun Yvonne Woodcock said residents may be unhappy about the work but it is necessary.
“I don’t think people will be very happy,” she said.
“These things have to be done. I’m sorry for the people that live around that area but at least it’s taking place during the school holidays so people won’t be going into school and stuff like that.”
Contractors Balfour Beatty will be carrying out the work and the temporary road closure will be in place on the bridge from Monday, July 29. Diversion signs will lead all traffic to an alternative route via Hayfield Lane, Gate House Lane and Mosham Road.
A Yorkshire Water spokesman said: “Yorkshire Water apologises in advance for any inconvenience caused by this work.
“Yorkshire Water and Balfour Beatty will not need access to private properties whilst this work is carried out, so residents are warned to be on their guard if they’re approached by strangers claiming the need to be allowed in. More information on how to avoid becoming the victim of bogus callers is available on the Yorkshire Water website at www.yorkshirewater.com.”