I got the following solution by googling:
Solution to the Heaven or Hell Puzzle
The question you should ask is “If I ask the other guard about which
side leads to heaven, what would he answer?” It should be fairly easy
to see that irrespective of whom do you ask this question, you will
always get an answer which leads to hell. So you can chose the other
path to continue your journey to heaven.
This idea was famously used in the 1986 film Labyrinth.
Here is the explanation if it is yet not clear.
Let us assume that the East facing door leads to heaven.
If you ask the guard which speaks truth about which gate leads to
heaven, as he speaks always the truth, he
would say “East ”. Now that the liar, when he is asked what “the other
guard (truth teller)” would answer, he would definitely say “West ”.
Similarly, if you ask the liar about which gate leads to heaven, he
would say “West”. As the truth teller speaks nothing but the truth, he
would say “West” when he is asked what “the other guard( liar ) ”
would answer. So in any case, you would end up having the gate to
hell as an answer. So you can choose the other gate as a way to
C H Mahadevan