On the other hand, your head could also be hurting from doing too much work or staring too long at a TV or computer screen (in that case, we suggest that you stop doing the work and close your eyes so that you can rest and relax until you feel better). If you're looking for a quick fix, over-the-counter medicine like Tylenol or aspirin can also help with a headache in many cases.
Sometimes people suffer from migraines with unknown causes, and need to take prescribed medication. Perhaps making some adjustments in your eating and/or sleeping habits can reduce the recurrence of head pain that is unrelated to physical impact (e.g., walking into a door). Please note that these are only suggestions and not medical advice; as with any health issue, the best solution may be to make an appointment with a licensed practitioner to review the problem -- or go to the ER if you've sustained a major injury.