Redirect HTTP to HTTPS Automatically

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

Redirect HTTP to HTTPS Automatically

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;

  1. Access your web hosting control panel and launch the File Manager
  2. 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]
  1. 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

Redirect HTTP to HTTPS Automatically

If you are using the WordPress CMS< it has a built-in URL redirector, you can send all HTTP requests to HTTPS URLs.

  1. Log in to your WordPress administration dashboard
  2. Hover over “Settings” on the left navigation bar, then click the “General” option.
  3. 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.

Rado

Author

Working in the web hosting industry for over 13 years, Rado has inevitably got some insight into the industry. A digital marketer by education, Rado is always putting himself in the client's shoes, trying to see what's best for THEM first. A man of the fine detail, you can often find him spending 10+ minutes wondering over a missing comma or slightly skewed design.

Write a Comment

Required*