The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to Redirect to SSL Properly

Discussion in 'General Discussion' started by Drumrocker365, Apr 17, 2014.

  1. Drumrocker365

    Drumrocker365 Well-Known Member

    Joined:
    Apr 15, 2014
    Messages:
    72
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hey there,

    I was wondering how I can use cPanel to make http:// automatically redirect to https://. For example, if someone enters http://billing.domain.net, they'll be redirected to https://billing.domain.net. Basically wanting a way to force https://.

    Thanks,
    Christian
     
  2. Drumrocker365

    Drumrocker365 Well-Known Member

    Joined:
    Apr 15, 2014
    Messages:
    72
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    I have later discovered that you just need to add this simple code to your .htaccess file:

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You can try using the following rule in your .htaccess file within the public_html directory:

    Code:
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    Thank you.
     
Loading...

Share This Page