1. I assume that You already enabled SSL certificate for Your website, for example Let's Encrypt (how to do it You can check HERE).
2. In Your /domains/domain.com/public_html directory create a file named .htaccess, if there is already such a file, edit it and add below code on top of the file.
3. Edit it and paste code:
4. Save it and upload to server
Thats all, Your webite should redirect now all requests from http://domain.com to https://domain.com.
If You wish to additionally add www to Your domain (http://example.com to https://www.example.com), above code will look like this:
If You wish to additionally remove www from Your domain (http://www.example.com to https://example.com), above code will look like this: