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!

SOLVED Force subfolder site to use https

Discussion in 'Data Protection' started by durangod, Feb 1, 2018.

Tags:
  1. durangod

    durangod Well-Known Member

    Joined:
    May 12, 2012
    Messages:
    365
    Likes Received:
    17
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Hi,

    I am having a heck of a time getting my subfolder (not sub domain) site working off of my main domain certificate.

    For example i have www.example.com and i have www.example.com/newsite

    https works fine on www.example.com
    but does not work on www.example.com/newsite

    i get "the page isnt redirecting properly" on firefox and on chrome it just fails.

    so in the main dir i put this in the htaccess file

    Code:
    # special code to force sub folders to use main domains certificate
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(subdirectory/.*)$ https://www.mysite.com/$1 [R=301,L]
    
    and i tried this line too (added the subdir name)

    Code:
    RewriteRule ^(subdirectory/.*)$ https://www.mydomain.com/subdirectory/$1 [R=301,L]
    
    
    but it is still not working... any ideas?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #1 durangod, Feb 1, 2018
    Last edited: Feb 1, 2018
  2. durangod

    durangod Well-Known Member

    Joined:
    May 12, 2012
    Messages:
    365
    Likes Received:
    17
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    I sure am glad i only have to do this stuff 1x a year because by the time i am done im ready to pack it all in.

    Anyway so far i have tried about 10 different htaccess rules to try to do this, both in the main domain and in the sub folder htaccess files. Nothing works...

    Now just fyi, i did install the certificate at domain user cp level and not in whm if that makes a difference.

    help lol ?

    update: i just remembered im using cloudflare free program, maybe that is the issue as i have not set the ssl over there yet.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. durangod

    durangod Well-Known Member

    Joined:
    May 12, 2012
    Messages:
    365
    Likes Received:
    17
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    OMG OMG OMG That was it... i just set cloudflare to full strict setting and bam it works...

    reminder to everyone if your banging your head against the wall, try to remember if you use cloudflare to check those settings. I very seldom have to mess with it so i get forgetfull...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,367
    Likes Received:
    1,856
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I'm glad to see you were able to solve the issue. Thank you for sharing the outcome.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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