How the speaker says the "H" word is what really matters.
An STD, a URL... whether it's "a" or "an" depends on how the following word is sounded, not how it's spelled. The first, STD, is pronounced as if it were spelled ess-tee-dee--starting with a vowel sound, which is why it requires "an." It doesn't start with "S" at all. The second, URL, is said as if it were spelled yoo-arr-ell (which looked like pirate dialogue before I threw in the hyphens), starting with a consonant sound, and therefore requires a preceeding "a".
To further complicate things, if the word starts with "H" and has three or more syllables, the formal writer or speaker uses "an" only if the first syllable is not accented, the second syllable is, and the vowel sound in the accented syllable is not a long u or eu. So it's a history lesson about an historic event. That leaves us with a hardbitten cop, a helicopter, a helium balloon, a hooligan, a humidor, and an habitual liar, an harmonious group, an heptathlon, an hibiscus, an holistic approach if the speaker is formal or academic.
[No, of course I didn't just know all of this! But I knew a little, honest.]
Of course, if it's dialogue or if the POV character is not formal, the writer can trust his or her inner ear, IMO.
Maryn, who is wasting brain space remembering the parts of the inner ear