The Mahabharata happened after the Ramayana, because we know that Lord Rama lived before Lord Krishna due to the fact that one lived in Dwapur Yuga, and the other lived in the Treta Yuga.
We also know that Lord Krishna was of Dwarka, which is a lost city found off the coast of Gujarat.
Carbon dating on this city has revealed that it is more than 32,000 years old, and is thus thousands of years older than the Indus Valley civilisation, which is thought to be an ancient civilisation far more advanced than anything of its time, as it had sewage and town planning which has not been seen anywhere else until recent history.
Also, as we know that Krishna is supposed to have heralded the Kali Yuga, it is clear that the battles of the Kurukshetra war must have taken place around 5800 years ago, to correspond with our calendars of the time.
However, the Ramayana is far older than that.
Many people say that Rama was born 7000 years ago based on the following evidence:
Date of Birth of Lord Ram
Aadikavi Valmiki in 1/18/8-10 of Ramayan has given details that Shri Ram was born on 9th tithi of Chaitra month during day time when the position of different planets vis-à-vis zodiac constellations and nakshatras (visible stars) was as under:
Sun in Aries 2. Saturn in Libra
Jupiter in Cancer 4. Venus in Pisces
Mars in Capricorn 6. Lunar month of Chaitra
Ninth day after Amavasya 8. Lagna as Cancer
Moon near the star Punar vasu (Pollux) in Gemini Constellation.
Moon & Jupiter were shining together in Cancer.
This data was entered into the ‘Planetarium Gold’ software, the results indicated that this was exactly the location of planets/stars vis-à-vis zodiac constellations on the 10th of January noon time in the year 5114 BC if viewed from latitude/longitude of Ayodhya (25°N 81°E). Thus Shri Ram was born on 10th January in 5114 BC.
This is completely valid, however what people forget is that this is the latest time that this event has been seen and it repeats every 28,000 years.
Also, if we were to believe that Rama and his army built the Adams Bridge, then archeological evidence shows that it is over 1.75 million years old. This may be attributed to the age of the stone and not the building, but nonetheless, the construction of the bridge must have taken place recently after the stone as if not it would not be there due to wave currents and the fact that the sea level has risen due to ice ages and the compounding effects of global warming.
Moreover, it is appropriate to have such a timing for the Ramayana because it falls inside the timing of the Dwapur Yuga, which took place between 2.2 million BCE and 0.86 million BCE.
However, if you feel that these timings are incorrect, then the escape route is that timings in the Hindu stories are inconsistent with the calendars that we follow nowadays, possibly because of the fact that people lived waaay longer than they do now back in the times of these stories.