That's a job for the government to do, and there's loads of avenues the government can do if it deems local stores something important for the general population: controlling commercial rents, direct subsidies (colloquially implemented as "tax breaks"), introducing extra taxes on online retail to finance these, or limiting at-scale discounts for Amazon, Walmart and other nationwide chains so that small retail has a chance to compete again.