SOLVED Force subfolder site to use https

durangod

Well-Known Member
May 12, 2012
516
47
78
cPanel Access Level
Website Owner
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?
 
Last edited:

durangod

Well-Known Member
May 12, 2012
516
47
78
cPanel Access Level
Website Owner
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.
 

durangod

Well-Known Member
May 12, 2012
516
47
78
cPanel Access Level
Website Owner
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...
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,267
463
Hello,

I'm glad to see you were able to solve the issue. Thank you for sharing the outcome.