Force SSL https for Website

  • May 14, 2025
  • 0 Comments

How to Force HTTPS (SSL) on cPanel Hosting

There are several methods to force your website to load via HTTPS in Imageleet cPanel Web hosting Account . Here are the most effective approaches:

Method 1: Using .htaccess (Recommended)

  1. Access your .htaccess file:

    • Go to cPanel → File Manager

    • Navigate to your public_html folder

    • Edit (or create) the.htaccessfile

  2. Add these rules at the top:

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

Method 2: Using cPanel's Built-in Redirects

  1. Go to cPanel →DomainsRedirects

  2. Select Permanent (301) redirect type

  3. Choose your domain from the dropdown

  4. Leave the "redirects to" field empty

  5. Select "https://" from the dropdown

  6. Check "Wild Card Redirect" option

  7. ClickAdd

Method 3: For WordPress Sites

If using WordPress, you can also:

  1. Install the "Really Simple SSL" plugin, or

  2. Add this to wp-config.php:

    define('FORCE_SSL_ADMIN', true);
    define('FORCE_SSL', true);

  3. Or go to Settings → General and change both URLs to https://

Method 4: PHP Force Redirect

Add this to your PHP files (before any output):

if ($_SERVER['HTTPS'] != "on") {
    header("Location: <a href="https://" "="">https://"</a> . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    exit();
}

Verification

After implementing:

  1. Clear your browser cache

  2. Test by visiting your site with http:// (should redirect to https://)

  3. Use SSL checkers like SSL Labs (https://www.ssllabs.com/ssltest/)

Troubleshooting

If you get redirect loops:

  1. Check for multiple redirect rules

  2. Verify your SSL certificate is properly installed

  3. Ensure your site loads properly with https:// forcing redirects

Remember to always back up your .htaccess file before making changes.

Please feel free to contact our support team if you still face problem and we will configure this for you.


How helpful was this article to you?

Posting has been disabled.