1. Home
  2. Knowledge Base
  3. cPanel
  4. Settings
  5. How to redirect a domain from http to https via .htaccess

How to redirect a domain from http to https via .htaccess

Step 1: Login to your cPanel account.
Step 2: Select the File Manager option under Files.
Step 3: Navigate to document root folder, select the .htaccess.
Step 4: Add the following codes into .htaccess.

+++
RewriteCond %{SERVER_PORT} 80 [OR]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.domain.com/$1 [R=permanent,L,NC]
+++

Step 5: Finally click the Save changes option.
Step 6: Now your domain will be directed from http to https.

Related Articles