A facile one-pot synthesis of 4-chloro or 4-bromonicotinic acid esters with optional 2- and 2,5-disubstitution on the pyridine ring has been developed from easily accessible enamino keto esters by a formylation followed by in situ intramolecular cyclization strategy under optimized Vilsmeier reaction conditions. The effect of the substituents on the β-carbon and the nature of the keto functionality were explored in detail to understand the mechanism of pyridine ring formation under the described conditions.