I watched this movie at least 47 years ago. I am positive about that because I was still a bachelor then.
It was a parody of Western movie with all the usual tropes of the small town, like saloon, sheriff’s office, and so on.
What was special is that, for some reason I do not remember, the inhabitants had dug many tunnels under the main street extending below many buildings, too.
I do not remember what happens during most of the movie, but at the end there is a cavalcade (or maybe a cattle rush) and most of the town collapses into the tunnels.