I wanted to enable https for my site, specifically, I wanted:
- http://jeremyfiggins.com
- http://www.jeremyfiggins.com
- https://www.jeremyfiggins.com
to all redirect to https://jeremyfiggins.com. Here’s how I did it (as a thcservers.com customer).
Enable SSL
THC makes this easy. Login to your cpanel (https://www.thcservers.com/#backend-login) and then under Security, go to SSL/TLS. Go to Manage SSL Sites.
Under Install An SSL Website, select your website from the domain drop-down and click Autofill by Domain. THC will use a pre-generated SSL certificate for your site. If you have a specific SSL certificate you want to use, you can do so by copy-pasting the certificate information into the text fields. Once your done, click Install Certificate and your site should be accessible via https.
Disable HTTP
In order to force all visitors to your site to use HTTPS, go back to the cpanel and under Files, go to File Manager. Go into the public_html directory.
We’re going to need to edit a hidden file, so go to Settings at the top-right and enable Show Hidden Files. Select the .htaccess file and click Edit. Put the following text at the top of the file:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www.
RewriteRule (.) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Click Save Changes and you’re done!