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 as separate folder? Can I set this?

Discussion in 'General Discussion' started by chewedtoothpick, Dec 28, 2008.

  1. chewedtoothpick

    chewedtoothpick Registered

    Joined:
    Dec 28, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hey, I am noticing through the demos etc that HTTPS and HTTP data are in the same folder... Is there a way to separate them? I need to because I have an intranet type site that has a separate Http site and https site and I want to keep it this way.
     
  2. chewedtoothpick

    chewedtoothpick Registered

    Joined:
    Dec 28, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    I kind of need to know this soon because I need to get a new server up and running within the next ~week...
     
  3. apscinsspl

    apscinsspl Well-Known Member

    Joined:
    Mar 15, 2008
    Messages:
    112
    Likes Received:
    0
    Trophy Points:
    16
    Http and https have the same document root in httpd.conf and contents are stored in same folder .

    You might want to try changing the document root in httpd.conf for domain.com:443
     
  4. DaveUsedToWorkHere

    DaveUsedToWorkHere Well-Known Member

    Joined:
    Dec 28, 2001
    Messages:
    689
    Likes Received:
    1
    Trophy Points:
    18
    You'll need to have root level access to edit /usr/local/apache/conf/httpd.conf to do this. You should see a configuration set for the domain that looks something like this:

    <VirtualHost xx.xxx.xx.xx:443>
    ServerName yyyyyy.com
    Server Alias www.yyyyyyy.com
    DocumentRoot /home/username/public_html
    ....
    .....
    </VirtualHost>

    Change the DocumentRoot line from /home/username/public_html to the folder that your https site should go to and then close httpd.conf in your editor.

    Then run this command:

    Code:
    /usr/local/cpanel/bin/apache_conf_distiller --update
    Then restart Apache for the changes to take effect.

    If you do not have root level access to the server and are a domain owner, you'll need to create a file called .htaccess in your public_html directory containing these lines:

    RewriteCond %{SERVER_PORT} 443
    RewriteRule ^/$ /directory_to_send_visitors_to


    This is only valid if the server owner has mod_rewrite enabled in Apache.
     
  5. chewedtoothpick

    chewedtoothpick Registered

    Joined:
    Dec 28, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    PERFECT! Exactly what I need. Thank you.

    Is it all possible to set it so that when I create new domains that they automatically have a separate HTTPS folder? I have about 4 domains on my server I want this for.
     
    #5 chewedtoothpick, Dec 30, 2008
    Last edited: Dec 30, 2008
  6. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    I do not think so that you can do it automatically. As Apache will automatically set DocumentRoot as

    /home/username/public_html in /usr/local/apache/conf/httpd.conf when you create a new domain from WHM.
     
  7. dave6166

    dave6166 Registered

    Joined:
    Jan 31, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    You might want to try changing the document root in httpd.conf for domain.com:443
     
Loading...

Share This Page