I think that it is the rear where generals ought to be. First of all, because they already have been junior officers who shared a little bit more of the 'front'. Second, they are aged people - even if not much - who cannot be sleeping in trenches and running hither and tither. Rommel made this in WWII and the result was that his health was severely damaged. And third and maybe most important of all, that you cannot allow to have generals KIA and that is a major risk when they are in the front line. Generals are 1% of all Armies and if you lose that 1% automatically the remaining 99% of your Army finds itself be-headed and useless.
However, there are certain exceptions to the rule. And I am going to refer only WWI and WWII examples, avoiding other ages examples.
In WWI, it is obvious that men as Joffre, Haig and Ludendorff couldn't be in the filthy and flooded trenches commanding millions of men from there. Why? Because it's impossible to command from there, it is to risky and not proper for a general. (I am not saying that it wouldn't have been useful, since men like Haig would have known that attacking through the mud at Ypres was impossible...) But in WWI not even NCOs were at the trenches... you barely saw a platton or company commander, forget about batallion or regiment commanders. When did you see a captain in the mud with the rats?! Never! And there's where the problem is. Those officers did have to be in the trenches seeing the horrible situation. WWI precisely had so many useless casualties because of officer's incompetence. A captain in his bunker thought that a line on a map called enemy trench could be taken with his men's bayonets though he had never seen that trench. The he ordered the NCOs to carry on the attack by telephone and the NCO had no other option but to send his men against machine guns and barbed wire... And when the first wave failed, the captain wanted a second, and a third, an even a fourth. In the night, his batallion was gone, no enemy trench had been taken but the captain won a medal because of his bravery.

[img]graemlins/no.gif[/img] That's an insult for the men... You had of course, exceptions like field marshal Von Mackensen in WWI who commanded from the back of his horse in a Napoleon-like way. Or brigadier general Sir Hugh Elles who commanded his Royal Tank Corps from the back of his own steel horse... But as Martin says, most WWI generals were sitting drinking wine in their Châteaus yelling everybody on the phone and sending thousands of troops to useless and secure deaths.
In WWII you have a very important improvement in comunication thanks to the radio and therefore it's easy for divisional commander or even corps commanders like Rommel, Guderian, Model to see the action themselves and react in the quickliest way. But do you think that field marshal Von Bock or Von Runstedt could have had huge annihilation battles like those in Minsk, Smolijensk or Kiev by commanding from the first tank in the front? Of course not. They had to command hundreds of thousands of men, thousands of guns, tanks, planes and millions of tons of supplies. You can only do that by having a headquarters full with maps, telephones, radios and a bunch of staff-officers.
Another example: Stalingrad. Can you imagine general Friedrich Paulus sitting with a telephone in the rubble of the tractor factory, avoiding sharpshooters' bullets while he commands 350.000 men in the city?! You can say that lieutenant general Vasili Chuikov did command his Army from a filthy hole inside the rubble of the city. Yes, he did that because there was a river between his forces and because his forces were only a Army Corps!
In modern wars, in which you can see the action when it happens and how it happens in CNN then it's far easier to seat in your headquarters and react as if you were in the very front.