Linux-based accounts use files .htaccessto handle redirection.
If you do not have a file .htaccess:
Start by creating a file .htaccessin the public_html or webroot folder . Within the file .htaccess, you can use the following code to redirect visitors, provided you have not already set up a file .htaccess:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?coolexample\.com
RewriteRule ^(.*)$ https://www.coolexample.com/$1 [R,L]
OR
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
If you host multiple sites in the same account, you need to make sure that you have set up a file .htaccessin the directory of the site on which an SSL certificate has been issued. You need to replace coolexample.com with your domain name to run the sample code.
If you have a file .htaccess:
- Do not make a copy of it
RewriteEngine On. - Make sure the lines begin with
RewriteCondandRewriteRulelie immediately after the existing onesRewriteEngine On.