The safest place is your home and nowhere else. But if you are outside and got stuck in heavy rain and thunderstorm, then just be a little careful and try to go inside any building or apartments. If this is also not available, keep the below key points in your mind and then according to the situations, take any steps:
Get inside the car, if available nearby and you will be safe. This is because the metal shell of your car disperses the lightning around you and to the ground. Though it is not completely safe, but safer than being outside.
Get as low as possible and then try to stand with your feet tight together.
Avoid standing near the trees, as they can be hit by lightning.
Stay away from tents/pavilions because they have metallic or at least frames made of other conductive material which makes it a risky option.
Avoid to being near any bodies of water as they are not a good option.
Pointed sharp edges are risky, hence stay away from them.
Most importantly, do not use your mobile phone.