Rules at sacred sites vary not just by country but by individual temple, mosque or church, so the reliable method is to look for signs at the entrance and ask an attendant when unsure.
Flash is widely banned because it damages frescoes, murals and textiles, and it disturbs worshippers. Some sites ban tripods, some charge a camera fee, and a few prohibit photography entirely, occasionally collecting cameras or phones at the door. Photographing worshippers mid-prayer is poor form everywhere, even where photography is technically permitted.
Remember the related etiquette that comes with the territory: shoes off where required, shoulders and knees covered, head covered or uncovered depending on the faith, and silence or low voices inside. If a ceremony is underway, put the camera away and simply be present. Respect shown at the door is usually rewarded with genuine warmth from caretakers.