Create an .htaccess file with the following contents and upload it to your public_html directory.
RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://www.yourdomain.com/ [R]
another method:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"