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.

https on default

Discussion in 'General Discussion' started by vmicovic, Aug 21, 2008.

  1. vmicovic

    vmicovic Well-Known Member

    Joined:
    Sep 4, 2007
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    I have some users with SSL cert.
    And now i wondering how to set that domain that when some body type domain.com or www.domain.com to go on https://www.domain.com ?
    Mean that automatic all work on secure connection...


    Thank you.
     
  2. vmicovic

    vmicovic Well-Known Member

    Joined:
    Sep 4, 2007
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
  3. acenetgeorge

    acenetgeorge Well-Known Member
    PartnerNOC

    Joined:
    Mar 6, 2008
    Messages:
    64
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Southfield, MI
    cPanel Access Level:
    DataCenter Provider
    An .htaccess Redirect will do this for you. I think this one will do the trick. Just add it to your .htaccess file, edit the domain name to your actual domain, and see if it works.

    ------------------------------------------

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain\.com [NC]
    RewriteRule ^(.*)$ https://www.domain.com/$1 [R=permanent,L]
     
  4. gupi

    gupi Well-Known Member

    Joined:
    Apr 27, 2004
    Messages:
    125
    Likes Received:
    0
    Trophy Points:
    16
    Although using the same .htaccess, my approach is a little bit different:

    Code:
      # Redirect all users to a SSL port
      RewriteEngine on
      RewriteCond %{SERVER_PORT} !=443
      RewriteRule ^ https://[B]www.domain.com[/B]%{REQUEST_URI} [NS,R,L]
    of course, domain.com must be changed with your real domain
     
  5. vmicovic

    vmicovic Well-Known Member

    Joined:
    Sep 4, 2007
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
    thank you guys, that resolve my problems :)


    best regards.
     
  6. vmicovic

    vmicovic Well-Known Member

    Joined:
    Sep 4, 2007
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
  7. gupi

    gupi Well-Known Member

    Joined:
    Apr 27, 2004
    Messages:
    125
    Likes Received:
    0
    Trophy Points:
    16
    A quick and dirty solution would be to place a .htaccess file in the root of each subdomain and put the condition
    Code:
    RewriteEngine off
    in the file.
     
  8. MaestriaNick

    MaestriaNick Well-Known Member

    Joined:
    Aug 6, 2008
    Messages:
    159
    Likes Received:
    3
    Trophy Points:
    18
    Code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{SERVER_PORT} !=443
    RewriteCond %{HTTP_HOST} ^(www\.)?YOURDOMAINNAME.COM
    RewriteRule ^ https://www.YOURDOMAINNAME.COM%{REQUEST_URI} [NS,R,L]
    
    the above rule will work as you want. Just replace YOURDOMAINNAME.COM with your domain name
     
  9. vmicovic

    vmicovic Well-Known Member

    Joined:
    Sep 4, 2007
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
    thank you gupi.

    that`s it.


    thank`s one more time to all.
     
  10. MantisComp

    MantisComp Active Member

    Joined:
    Oct 16, 2008
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    I have tried this and it fails with a page loop.
    All I want to do is redirect all visitors that come in on http://secure.mydomain.com to https://secure.mydomain.com and this rule to apply to all folders as well. No other domain - just the one as show, no need for www etc.

    This my .htaccess:
    # Redirect all users to a SSL port
    RewriteEngine on
    RewriteCond %{SERVER_PORT} !=443
    RewriteRule ^ https://secure.mydomain.com%{REQUEST_URI} [NS,R,L]

    Any ideas?
    Thanks
     
  11. MantisComp

    MantisComp Active Member

    Joined:
    Oct 16, 2008
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    Fixed, my web app was also trying to redirect.
     
  12. aqjedd

    aqjedd Member

    Joined:
    Oct 6, 2009
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
Loading...

Share This Page