There are no rules about commas. It depends mainly on the length and intonation of the sentence, and most commas are optional. With a small number of words, such as 'however', the comma makes a difference to the pronunciation, so it is required to distinguish two meanings, but for most common words such as 'because', 'after', 'but', it's up to you.