Secure Sockets Layer (SSL) certificates help keep websites and visitors safer by encrypting data during browsing sessions. If you have implemented your SSL certificate, it is also advisable to redirect all HTTP requests to the HTTPS URL.
Redirecting HTTP to HTTPS can be done in several ways;
Using the .htaccess File
The .htaccess file is a high-level server configuration file that is very useful, for example, in redirecting URL requests. To redirect HTTP to HTTPS using this file;
- Access your web hosting control panel and launch the File Manager
- Find and open the .htaccess file for editing. You can usually find it in the “public_html” directory or the main directory for your website.
Add the following code to the file;
- RewriteCond %{SERVER_PORT} 80
- RewriteCond %{HTTP_HOST} ^(www\.)?yourdomain\.com
- RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
- If the file does not exist, create a new file and add the following code;
- RewriteEngine On
- RewriteCond %{SERVER_PORT} 80
- RewriteCond %{HTTP_HOST} ^(www\.)?yourdomain\.com
- RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
Save the file as .htaccess when exiting the editor.
Using WordPress
If you are using the WordPress CMS< it has a built-in URL redirector, you can send all HTTP requests to HTTPS URLs.
- Log in to your WordPress administration dashboard
- Hover over “Settings” on the left navigation bar, then click the “General” option.
- You will need to update the “WordPress Address (URL)” and “Site Address (URL)” fields to include HTTPS. For example, if your URL is “http://www.youdomain.com,” you should change it to “https://www.yourdomain.com.”
Note: In some instances, the URL area may be uneditable. This disabling of the edit box means you will not be able to make the amendments via the WordPress dashboard but need to edit the WordPress database tables instead.
Why HTTPS is Important
Many search engines are now enforcing the use of SSL certificates. Visitors will see warning indicators when attempting to access websites that are not HTTPS certified. At the same time, search engines also consider HTTPS as part of their search ranking algorithms.
You do not need a commercial SSL certificate in most cases. Non-commercial websites that do not handle user data can use a free SSL from Let’s Encrypt. ScalaHosting offers the use of free SSL as well as makes commercial SSL from GeoTrust and Symantec available.