The rule you are referring to here is commonly misunderstood. Rather than looking at the initial letter of the word, you should focus on the initial sound. "A" precedes words beginning with a consonant sound while "an" precedes words beginning with a vowel sound.
For example, some words are spelled with a vowel, but make a YOU (IPA: /juː/) sound: URL, unicorn, and European to name a few. Since the initial sound of each word is a consonant sound, all of these ought to be preceded by "a": a URL, a unicorn, and a European man.
Once and one also cause confusion since they begin with "o" but sound like "w". As such, we should use "a" before them: "a one-time event" or "a once in a lifetime opportunity".
Now let's take a look at "h" words: hour, honor, happy, house, hair, and heir. "H" words are tricky because there are two ways to say them: aspirated and unaspirated. Pronounce these words out loud with a piece of paper close to your lips. Happy, house, and hair all move the paper while hour, honor, and heir do not. That is because the first group uses an aspirated ("with breath") "h". The second group uses an unaspirated ("no breath") "h". Aspirated h's begin with a consonant sound (as in house: /hʌʊs/) while unaspirated h's begin with a vowel sound (as in hour: /ˈaʊɚ/). Now let's apply the article rule: an hour, an honor, a happy dog, a house, a hair, and an heir.
To summarize, the rule of the "a" and "an" articles is to apply them according to the initial sound of the noun they are attached to. If you are unsure of which article to use, sound out the noun or write it out phonetically (IPA). Nouns beginning with a vowel sound ought to be preceded by "an" while nouns beginning with a consonant sound ought to be preceded by "a".