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, 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;

  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, 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.

  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.

Was this helpful?

What’s your goal today?

1. Find the right Managed VPS solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lighting 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. Fill out the form, and we’ll be in touch.

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.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.

Photo

Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. Learn how to grow your website in 2024

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

An Exclusive Insiders Look Behind The SEO and Web Development Curtain

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.