strictly speaking it's if the word starts with a vowel *sound*. I'd say an hour, an historic occasion, but not an hotel; but some people do pronounce it as an otel.
actually, I've got myself wrong, I'd say a historic occasion and a history. But soem would say an historic occasion - but never an history, for some reason; I assume it's because the stress falls on a different syllable.
Some words have changed over the years. An umpire, an apron, an adder used to be a numpire, a napron, a nadder.