This is a quote from scripture we often hear but I don't think we fully understand correctly. I think language is such an interesting thing because on the one hand it enables us to communicate our thoughts and ideas with others. On the other hand, it limits the true transmission of these thoughts and ideas to the meanings associated with the words we choose to use and sometimes those words don't really adequately or accurately describe the thought, feeling, or message we wish to convey.
With this quote I think for most of my life it was trying to tell me that people who do bad things can't be happy. But I have seen lots of people who tell me they are pretty happy doing things that are not "righteous." I have even had friends tell me they are happier after they left the church and stopped living the commandments.
On a more recent reading of this scripture in Alma 41:10-11 where Alma tells his wayward son that wickedness never was happiness, I noticed in the next verse that Alma kinda defined what he meant by happiness. He says that all men who are in a state of nature, or a carnal state are in the gall of bitterness and the bonds of iniquity. "They are without God in the world, and they have gone contrary to the nature of God; therefore they are in a state contrary to the nature of happiness."
This last time reading this I came to see that Alma's definition of happiness is to be with God.
There are lots of things in this life that we must do or not do to live "after the manner of happiness" or in other words - to live with the Spirit of God abiding with and in us in this world. Sometimes we think we would be happier to just do them or stop doing them. But I have experienced enough of sin and repentance to know that when we are brought to a perfect understanding of our guilt, it is not happiness we will feel.
True happiness is living with the sanctifying presence of the Holy Ghost burning within us. It is living in daily repentance and striving to do and act and become like Christ so that at that last day or any day before then we can know we are right before the Lord and can call on Him with confidence in our trials. This is true happiness. This happiness is independent of the circumstances of our lives and can be like a fount of living water to our souls.