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 control https

Discussion in 'Bind / DNS / Nameserver Issues' started by Dennis Moore, Dec 4, 2015.

  1. Dennis Moore

    Dennis Moore Registered

    Joined:
    Dec 4, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    zyzzyx
    cPanel Access Level:
    Root Administrator
    I'm familiar with unix in general, but not cpanel. I've installed an ssl certificate,
    Code:
    http://www.example.com and https://www.example.com 
    work fine but how do you control which gets used and where? I'd like to use https for login urls and forms with passwords, but I get the impression ssl needs to be used on the entire domain, is that true?

    I have a php application which would respond if I could set:
    SetEnv HTTPS on

    I tried .htaccess rewrites but results are wildly unpredictable, requests for port 80 and 443 both go to the same .htaccess file

    Code:
    #RewriteCond %{HTTPS} off
    #RewriteCond %{REQUEST_URI} ^/login
    #RewriteRule ^(.*)$ [URL]https://%{HTTP_HOST}/$1[/URL] [R=301,L]
    
    
    Code:
    
    /etc/redhat-release:CentOS release 6.7 (Final)
    /usr/local/cpanel/version:11.52.1.3
    /var/cpanel/envtype:kvm
    CPANEL=release
    Server version: Apache/2.2.31 (Unix)
    Server built:  Nov  9 2015 23:54:15
    Cpanel::Easy::Apache v3.32.5 rev9999
    PHP 5.4.45 (cli) (built: Nov 10 2015 00:01:59)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
      with the ionCube PHP Loader v4.7.5, Copyright (c) 2002-2014, by ionCube Ltd., and
      with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies
    
    
     
    #1 Dennis Moore, Dec 4, 2015
    Last edited by a moderator: Dec 4, 2015
  2. Dennis Moore

    Dennis Moore Registered

    Joined:
    Dec 4, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    zyzzyx
    cPanel Access Level:
    Root Administrator
    was trying to use my-domain dot com as an example, but guess it's not the best choice. I have nothing to do with consolidated armor products
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,446
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Sorted that for you. ;)
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    You will need to use custom Mod_Rewrite rules in your .htaccess file if you want certain http requests redirected to https. You may want to post on a forum such as StackOverflow for specific guidance on what type of custom rules you could implement.

    Thank you.
     
  5. Dennis Moore

    Dennis Moore Registered

    Joined:
    Dec 4, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    zyzzyx
    cPanel Access Level:
    Root Administrator
    What does that mean, It'll never work? Ok how about for an standard user of cpanel, how do you setup https?
     
  6. Dennis Moore

    Dennis Moore Registered

    Joined:
    Dec 4, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    zyzzyx
    cPanel Access Level:
    Root Administrator
    ok well for anyone else experiencing strangeness applying https, the following does work to apply https to the entire site. My issue was with the application cache not cpanel.

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
    </IfModule>
    
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,675
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page