Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

need redirect to https://

Discussion in 'General Discussion' started by logikstudios, Aug 29, 2007.

  1. logikstudios

    logikstudios Well-Known Member

    Joined:
    Nov 2, 2006
    Messages:
    158
    Likes Received:
    0
    Trophy Points:
    166
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. DReade83

    DReade83 Well-Known Member

    Joined:
    Oct 20, 2006
    Messages:
    196
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Cheshire, UK
    Use PHP code to force HTTPS. I did with a client's site and it worked a treat...

    Code for forcing a HTTPS connection where needed:
    PHP:
    <?php
        
    if($HTTP_SERVER_VARS["HTTPS"] == "off") {
            
    header("Location: https://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
        }
    ?>
    Code for forcing a HTTP connection where needed:
    PHP:
    <?php
        
    if($HTTP_SERVER_VARS["HTTPS"] == "on") {
            
    header("Location: http://".$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
        }
    ?>
    Enjoy! :D
     
  3. logikstudios

    logikstudios Well-Known Member

    Joined:
    Nov 2, 2006
    Messages:
    158
    Likes Received:
    0
    Trophy Points:
    166
    Hi. Is there an easier way of doing this? I would prefer this to be at domain lever rather than at the code.

    Thanks,
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. maggy

    maggy Active Member

    Joined:
    Jun 9, 2004
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    151
    use an apache rewrite in httpd.conf
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice