Road transportation serves as the primary mode for hazardous materials (hazmat) transportation in China. However, the current academic literature lacks sufficient exploration of optimizing transportation networks through road-blocking strategies. This research proposed a bi-level programming model, where the government acts as the decision-maker in the upper-level programming, and the transportation enterprise operates at the lower level. Road-blocking strategies are employed by the government to mitigate transportation risks. We developed exact solution algorithms for the upper programming and employed genetic algorithms for the lower model separately. Finally, using a real road network in Beijing as a case study, we showcased the effectiveness of our approach. We computed government decision schemes and enterprise transportation routes for 13 scenarios, and conducted a further discussion and analysis on scenarios with road service levels of 83% and 80.9%. The method and results presented in our study can adeptly dissect the transportation of hazmat in city areas, offering insightful perspectives and robust support for devising more streamlined management strategies.