Knowledge Base

How to force SSL with .htaccess?

144 views Published 12 Apr 2021 Updated 27 Mar 2026

Why Force SSL?

All Gravity Host accounts include free SSL certificates via Let's Encrypt. However, visitors might still access your site via http://. Forcing SSL ensures every visitor gets the secure https:// version automatically.

Method 1: .htaccess (Recommended)

Add these lines to the top of your .htaccess file in your site's root directory:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

You can edit .htaccess via cPanel's File Manager or by clicking Files on your dashboard.

Method 2: WordPress

If you use WordPress, go to Settings > General and ensure both the WordPress Address and Site Address start with https://.

How to Verify

After making the change, visit your site using http://yourdomain.com — it should automatically redirect to https://. You should see a padlock icon in your browser's address bar.

Gravity Host website secured with HTTPS

The Gravity Host website running on HTTPS with a valid SSL certificate

Was this article helpful?

I need more help

Related Articles

How to Install WordPress with Softaculous in cPanel Managing DNS Records with Zone Editor Getting Started with Your Hosting Account