The earth has been here millions and millions of years and we've only had the bible for a couple of thousand.
What happens to the people who lived before religion?
Is there no afterlife for them? or do they go to hell?
Are these ones in "hell"? No. If we truly believe that the whole Bible is from God, not little bits we like, then what happened to people before the Bible began to be written and even before Jesus came to earth will of great interest to you.
What does the Bible teach about death?
Ecc 9:3- dead are conscious of nothing.
Ps 146:4- their thoughts perish.
Jon 11:11-14- Lazarus was "asleep" then "had died."
God told Adam that he was going to go back to the ground when he died "for dust you are and to dust you will return."- Gen 3:19.
A man named Job suffered terribly from various affictions. He prayed to go to "hell"(Job 14:13-KJV) not to continue his suffering but to find peace and rest until God called him back, or literally resurrected him.
The hope for all people ought to be that upon their death God will act justly to them whether they knew he existed or not. It is unthinkable for God to act in any other way.
The problem is that man has interpreted the Bible in a way that people live in fear of death. Dante's inferno comes to mind. It makes God out to be cold, cruel and distant. He isn't, but it may take time for you to come to appreciate it. "Keep asking and you will find, keep knocking and it will be answered you."