The Islamic solution to that (and to many other relationship-related problems) is to revive your spiritual life so that it feels as important as your material life.
If through worship, supplication, Quran reading and reading of beneficial books we increase our level of spirituality, so that we feel close to God, and so that the afterlife feels as important as the present life to us, then the troubles of this life start to appear small and insignificant, and they lose the power to hurt us.
Most of us have experienced such a state a few times in our lives. Perhaps it was during one Ramadan where we start reading a lot of Quran, attending prayers at the mosque, listening to beneficial lectures and watching beneficial programs on TV, so that we started to feel God’s presence in our lives, and so that we eagerly thought of meeting Him in the afterlife and experiencing the real life that awaits us there. Usually this state passes quickly, because we stop doing the work necessary to maintain such a state.
If you can recreate such a state in yourself, then your past relationship will stop feeling very important to you. Through the work of worship and devotion, your brain will start to realize new priorities in life; ensuring a life that pleases God, and ensuring a good afterlife. When the afterlife feels important to you, when you worry about your record of deeds, wanting to add good deeds to it and erase sins, when you feel as if your real life has not started yet, that your true home is in Paradise, then the troubles of this life will start to appear insignificant.
Maintaining such a state requires continuous daily work. You may be able to achieve it in a few days, so that you start to feel that you are over your broken relationship and so that you feel carefree and unburdened again, but if you stop doing the work necessary to maintain this state, your spiritual feeling will depart, and the importance of the broken relationship and the hurt associated with it will come back.
It is the normal state of humans to be hurt by this world and to suffer. Living in a state of high spirituality is against human nature, which always wants to be attached to the material world. Daily work is needed to escape the human state of suffering so that we achieve peace by being close to God and the afterlife.
Whenever something in this world hurts you greatly, just ask yourself, “How important does the afterlife feel to me?”, if it doesn’t feel very important, if it feels like a faraway concern, then you know what to blame for your suffering. You need to do sufficient work daily to bring the afterlife into your present life, and in this way this world loses the power to hurt you.
Another way to get over a relationship is to be in an equally good or better relationship. But there is no guarantee that one can achieve this, while achieving closeness to God is guaranteed if you put in daily effort. If wonder how much effort exactly, then I mean sufficient effort for the afterlife to feel as important as the present life. You do need to be a saint who dedicates every moment to worship, once you make it a habit to do sufficient work for the afterlife to feel as important as the present life, then you will still have many hours every day to do anything you enjoy doing.
Due to the importance of love relationships in our minds, even though a heightened spirituality will be of great help, it may not be sufficient to help us avoid all the pain associated with the situation. There may be no complete solution except entering a new phase in life, such as a new relationship, a new job or living in a different area.
If you achieve and maintain closeness to God, then pray that He heals you and gives you something better than what you have lost, then He will answer you.
Whosoever fears God, He will create for him a way out. (The Quran, verse 65:2)