Set Website default to HTTPS Print

  • 0

How to set your website so that if someone just types "example.com" they will get "https://example.com"

(Note: this of course will only work if you have an SSL key installed on your account)


This change will be made via your htaccess file.

To get to this file ether Login to cPanel or connect via FTP

cPanel
Go to Files Manager
Navigate to Public HTML
look for htaccess, right-click and select edit.

FTP
Navigate to Public HTML
look for htaccess and download to edit.

Add the following to your htaccess file, usually at the top:


RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com

RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]



Replace "example\.com" and "www.example.com" with your domain name.

Save the file

You can test by typing your website name without "https://" and make sure it rewrites.

Was this answer helpful?

« Back