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 ^(.*)$$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 ^(.*)$$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 “,” you should change it to “”

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.

Was this helpful?

Do you want to make your WordPress/WooCommerce site lightning fast?

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Just fill in the form below and we will get in touch with you.

Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Do you want to learn how to grow your website in 2023?

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. You will learn about:

  • What is the future of SEO and how you can be ahead of the curve
  • Web Design best practices and why they matter
  • Secrets to getting the foundation for your website to thrive

An Exclusive Insiders Look Behind The SEO and Web Development Curtain


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.