From The Oxford Dictionary of American Usage and Style*, by Bryan A. Garner:
awhile; a while After a preposition, it should be spelled as two words: He rested for a while. Generally, however, you're best advised to use the term adverbially without the preposition and spell it as one word: He rested awhile
From The American Heritage Dictionary of the English Language**, usage note at "awhile":
Awhile, an adverb is never preceded by a preposition such as for, but the two-word form a while may be preceded by a preposition. In writing, each of the following is acceptable: stay awhile; stay for a while; stay a while (but not stay for awhile).
*The Oxford Dictionary of American Usage and Style. Oxford University Press. 2002
**The American Heritage Dictionary of the English Language. Houghton Mifflin Company, 1996