I’m sorry for the punny title — despite the fact that I have not written on spaces in words/phrases, and despite the fact that today’s entry is on the distinction between a while and awhile, there was no need to call it that. If it makes you feel any better, I’m paying the price for this title now, as my brain is stuck on an infinite loop of the Staind song with this title.
But having that song is my head is just as well, because Staind got it wrong. According to Amazon, the song’s title on the CD is “It’s Been Awhile”, when it ought to be “It’s Been a While”. The basic idea with a while/awhile is that it’s two words when it’s a noun phrase, and one word when it’s an adverb. One way to check this is to see if you can replace a while/awhile by for a while. If you can, it’s one word; if you can’t, it’s two words. So, for instance:
(1a) After the needlessly long hike, I slept awhile and dreamt of tossing the hike-leader off a cliff.
(1b) After the needlessly long hike, I slept for a while and dreamt of tossing the hike-leader off a cliff.
(2a) It’s been a while since I thought that Staind was a good band.
(2b) *It’s been for a while since I thought that Staind was a good band.
In sentence (1a), awhile refers to the period of sleeping. It’s an adverbial phrase, modifying slept. In sentence (2a), you’re using a while refers to the length of time between when I thought Staind was a good band and now (when, of course, I think Staind is a great band). It’s a noun phrase, and could grammatically be replaced with a more explicit length of time, such as ten minutes, 600 seconds, or one-sixth of an hour, but not by the phrase for ten minutes.
Awhile isn’t a really big player in Standard American English anymore, if it ever was. Google Books turns up ~2000 hits for awhile in books since 2000, compared to ~48000 for a while. In my experience, people generally use for a while instead of awhile. This is a happy circumstance, because it means that when you’re uncertain about which form to use, you’ll be pretty likely to succeed if you choose a while with the space. I would even go so far as to say that you will always succeed if you include the space; the Oxford English Dictionary considers a while to be an acceptable spelling for both the adverb [1c(a)] and noun [1c(b)] uses. In fact, the adverbial sense was originally two words; its first two attestations in the OED (from 1000 and 1250 AD) were as two words, and only later does the single-word spelling appear. And, though the OED considers it an improper usage, awhile as a noun phrase has been attested in serious writings over 100 years ago (1872, 1882). So you’re not in bad company if you add or subtract a space improperly.
[I forgot to mention this at first, but this post was actually the result of a request by erinstraza. I intend to respond to more of the backlog of requests in the near future.]
Summary: Here’s the deal with awhile/a while. One word means adverb, two words means noun phrase. (As a possible mnemonic, adverb is a single word and noun phrase is two words.) If you can replace it with for a while, it’s one word. You can’t really be considered wrong (by British standards, at least) if you always use it as two words, and you probably oughtn’t to be considered wrong if you always write it as one — but I would advise against that.