TL;DR: Going back to OP what should the rules be, I think there is absolute morality; codes of ethics (including societal laws) overlap with, but do not perfectly correspond with, morality.
Non-TL;DR:
We may also not always know morality. Slavery of innocents (as punishment for a crime is more complex) is and was immoral, but ethically, was/is considered proper in many societies, and many people thought it was moral (or convinced themselves it was, dictated biblically, warranted because might makes right, whatever) and didn't think it was immoral. I think they were wrong, there is an absolute morality, and I might wrongly think some things that are ethical and that I believe to be moral, are - when in actuality they're not. I'm not omniscient.
Note, while I am religious, I do think that some principles of morality may be found without religious belief. The golden rule and/or the Kantian ethical equivalent, etc. But how it is applied may be problematic. Some would say e.g.:
I am [insert religion], therefore everyone is free to follow the same religion. Or I am in a happy heterosexual marriage, therefore everyone else is free to be in a heterosexual marriage.
Others would see it more as, I am [insert religion], therefore the golden rule means everyone should be free to follow their choice of religion, or none, and change, as they wish. Or I am in a happy heterosexual marriage, therefore everyone else should be free to structure their relationships as they wish and try to be happy as I am.
That is, while I think some behaviour is immoral, my morality and the golden rule to me means that people should be free to pursue activities that I think are morally (absolutely) wrong. For instance, my values of free speech mean that I think the better moral view is to allow offensive speech to occur rather than punish it (with some limits e.g. defamation, direct immediate calls for specific violence, etc.) - even though I consider the offensive speech morally (absolutely) wrong, I think free expression an absolute moral good that requires the possibility of some immoral speech. And I want ethical rules (laws) to support that. Some others would argue that hate speech etc. should be punished, and maybe if there weren't such a history of punishing speech that violated societal norms - including at various times and places preaching religious freedom and tolerance, gender equality, anti-slavery, etc. - I'd be more open to such arguments.