Make the city unfriendly to masses of pedestrians rushing on your palace to topple you?
A successful dictator is someone who can manipulate the masses of pedestrians to rush on the palace... to cheer the leader (and to stomp on whatever political enemy the dictator has). A dictator who has to hide from the people is a poor dictator, and the life expectancy of such a regime tend to be short.
If you are interested in details, you should read "Coup d'État: A Practical Handbook" by Edward Luttwak.
Many revolutions that worked, worked because the people in the capital physically wrested control, power is a funny thing, many people that have real power (example: the army soldiers, that actually have the guns with them), prefer the status quo unless it is very clear something changed (example, the soldiers might obey some rebels if the rebels kill and replace part of the chain of command).
In any case, I seriously doubt any armed revolution would happen in Brazil anytime soon. It seems the nation has held popular presidential elections continuously since 1989. You can't persuade people to die on the street, when they can just wait four years and vote the man (or woman) out.
In any event, I really hope (and believe) that Brazil is not on the brink of a coup or civil war. It would be insane to throw away the progress that has been made in recent decades. There should be a way to sort out the Petrobras corruption scandal without resorting to violence.
Also, the
Brazil changed the capital for that purpose too, and made it masterfully:
Brazil had two previous capitals, the first is in Salvador, the capital was there for foreign military reasons: The city is a natural fortress, to attack Salvador by sea you need to navigate inside a bay that has cannons on both sides of the entrance, and the coast is VERY high (Salvador major landmark is a elevator, that take people from the coast to the city proper... obviously a invader army cannot use said elevator, it was deliberately designed to not support an army).
Later it was moved to Rio de Janeiro, because Rio de Janeiro was the new focus of economic activity, mostly for agricultural reasons (Brazil southeast is much more fertile than northeast, also in southeast countryside you could mine gold).
Currently, São Paulo-Rio Megalopolis has 40 million people (out of 200 million on the whole country), crammed in 0.5% of the country territory.
And precisely to avoid this, the capital now is Brasília, Brasília is in the middle of nowhere, to get there by road you cross hundreds and hundreds of kilometers of roads bordered by forests, tiny villages and farms, the only actual "reasonable" way to get in or out of Brasília is by plane, in fact when Brasília was first built, all construction materials that could not be gathered on-site had to be shipped by plane.
And the city itself was designed in a way that the population cannot take over, the government buildings are wide apart, there are lots of sniper spots on said buildings (ie: defenders can snipe attackers easily), and it also allows tanks to roll around as necessary.
We have unrest here in Brazil, tomorrow, I expect many thousands to take the streets to try to topple the government (most of the protesters want impeachment, but many want outright army coup, even civil war is necessary), but all of those people will be in São Paulo and Rio de Janeiro...
The government will be sitting safely in the capital, the president even called all ministers to the capital to wait, and the federal government has a separate defense militia (we have federal police, armed forces, and the "National Guard", the "National Guard" does not obey the defense minister, neither the police hieararchy, and is directly under the president, also the "National Guard" people can easily rally and wait in the capital, their numbers are only enough to defende the capital, many of their members are government supporters, and the army suspect that the National Guard was created precisely to counter the army itself.