Don’t attack others
When you attack others you give them the chance to come back for revenge by clicking on the revenge button. If you want to reduce the number of attacks on your village stop attacking others.
Join a clan
People are less likely to attack a village when the castle indicates that the player has joined a clan. The fact that some people fear castle troops can reduce the attacks on your village.
Put the castle in the middle of the village
When the castle can hardly be reached many players will avoid attacking your village as they will find it very hard to lure the castle troops out before attacking you.
Don’t make the town hall easily reachable
When a player finds that he can easily reach your town hall he might become more encouraged to attack you as he will know that he can easily win if he just took it out.
Keep your shield active
You can buy an active shield to prevent people from attacking you or you can attack people less to prevent your sheild from running out faster. When you attack someone your shield gets reduced automatically.
Spend your resources fast
So many players attack others just to get more resources. If you don’t have enough resources many people will become discouraged to attack you as the attack won’t be worth the effort. (See How to Protect Resources in Clash of Clans?)
Upgrade your defenses to the maximum
Most players assess the strength of the defenses before attacking someone. If your defenses seem strong enough they might discourage others from attacking you.
Keep your buildings close to each other
When you spread out your buildings over the map it will become harder for you to provide them with enough protection as you won’t have enough defenses to do so. Keeping the buildings close to each other and to the defenses can provide you with a better protection.
Upgrade your walls
One of the first things potential attackers notice is the strength of your walls. If your walls seem weak an attacker might become motivated to attack you.
Leave the enemy graves
Some players can get intimidated by the number of graves around a village. If you leave those graves without collecting the elixir from them then you might intimidate some players.
Use complex wall structures
Don’t put a square wall around all of your buildings then leave them this way. Make sure you put a complex wall structure so that you demotivate other attackers.
Distribute your defenses evenly
Make sure that your defenses are evenly distributed across your village. Also make sure that most buildings are protected against both ground and air attacks. (See What do villagers do in Clash of Clans?)
Don’t upgrade many defenses at once
When you upgrade more than one defense simultaneously you actually encourage other attackers to attack your poorly defended village.
Don’t place some buildings in a remote area
When you place some buildings in a remote area you might motivate a player to attack you because he might believe that he can easily take out 50% of your defenses since some of your buildings are not guarded.