| +91 73181 42255 |
All tutorials
Security & SSL · 3 min read

How to Force HTTPS with .htaccess

Once SSL is active, you should force all traffic to HTTPS so nobody lands on the insecure version of your site. This is done with a small rule in your .htaccess file.

  1. 1

    Open File Manager

    In cPanel, open File Manager and go to your site's public_html folder.

  2. 2

    Edit (or create) .htaccess

    Enable "Show Hidden Files" if needed, right-click .htaccess and choose Edit. If it doesn't exist, create it.

  3. 3

    Add the redirect rule

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

  4. 4

    Save & test

    Save the file, then visit http://yourdomain.com — it should jump straight to the https:// version.

Tip: Don't want to edit code? Our free .htaccess Generator builds this rule for you.
Stuck on a step? Our team is here 24/7.
Loading...