written by
Rich Martinez

How to Force Web Browsers To Use HTTPS

1 min read

You might think that because you add an SSL certificate on your Wordpress website that it should automatically add "https://" in front of all your webpages on your Wordpress sites. Unfortunately, it's not that straightforward.

You have to edit a file called .htaccess and add some code at the top of the file. Here's how it's done:

  1. Login to Cloudways
  2. Go to Applications
  3. Go to Applications Settings
  4. Under the Reset Permission, click on the word Reset (this needs to be done otherwise FileZilla won't be able to upload the revised file)

Open FileZilla (if you haven't created an SSH key, see this article first)

  1. File-Site Manager
  2. Select your Wordpress Site from the list
  3. Then click on Connect

Open the public_html folder on the Remote Site

Right-click on the file .htaccess and open with "Text Edit"

At the very top of the file insert this code (use this code Only if you are using Cloudways as your web host):

RewriteEngine On 
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

For other code that you can insert into .htaccess see the official documentation on Cloudways blog: here