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 do I redirect secure connections to subdomain and show same content?

Discussion in 'Security' started by stefanbc, Apr 22, 2015.

  1. stefanbc

    stefanbc Well-Known Member

    Joined:
    Apr 13, 2015
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    toronto
    cPanel Access Level:
    Root Administrator
    HI,

    I have only one secure certificate on secure.adomain.com and I would like to make sure that the content from adomain.com/secure-form redirects to https://secure.adomain.com/secure-form.

    I have the web redirect figured out but I don't know what I have to do to make sure the same content from adomain.com is shown at secure.adomain.com and if possible force all secure.adomain.com to use SSL.

    What files do I have to edit to achieve the above, maybe start with making sure the content is visible for the subdomain as well then make sure only secure connections are allowed.

    Thank you
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,834
    Likes Received:
    672
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    You could try an entry in the .htaccess file like this:

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain\.com [NC]
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://domain.com/$1 [R,L]
    Thank you.
     
Loading...

Share This Page