If you do not have a .htaccess file, create a .htaccess file in the public_html folder or in the root folder of the site.
Write the following code to the file:
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
If the .htaccess file already exists
Do not duplicate RewriteEngine On.
Ensure that lines starting with RewriteCond and RewriteRule immediately follow RewriteEngine On.