Results 1 to 2 of 2

Thread: HTTPS Subdomain - redirect HTTP to HTTPS

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    1

    Default HTTPS Subdomain - redirect HTTP to HTTPS

    I recently installed an SSL certificate on a subdomain following the steps at cPanel. Lets just say the domain is example.com and the subdomain is sub.example.com.

    1. I updated the userdata file for the subdomain and changed the IP address to the IP I wanted to use
    2. I updated the example.com zone file and changed the IP for the A Name for the subdomain to the IP I wanted to use
    3. Using domain tools I checked that sub.example.com resolved to the new IP which it does.
    4. I then installed an SSL certificate on example.com and then on sub.example.com

    When I visit http://sub.example.com I get the default Apache account screen, and when I visit https://sub.example.com I get the cPanel 404 page. If however I enter https://sub.example.com/admin (the location of my admin section) the page loads and I can login.

    I thought that this might be a propagation issue however as the subdomain resolves to the IP and I can reach the admin page I suspect it is not a propagation issue and possibly an incorrect zone file.

    I can now access the site via HTTPS but HTTP returns 404 errors or the default Apache page.

    I have tried htaccess redirect using:

    Code:
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
    But this does not redirect sub.example.com/index.php to https://sub.example.com/index.php. Same Apache message as previous.

    Using the 301 redirection in cPanel does not redirect either.

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: HTTPS Subdomain - redirect HTTP to HTTPS

    Could you check the /var/cpanel/userdata/username/subdomain.domain.com and subdomain.domain.com_SSL files? Ensure the paths are all correct for each file. Ensure the IP is correct for each file.

    If it isn't and you revise anything, then make a backup of httpd.conf after fixing the file(s), rebuild httpd.conf and restart Apache:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak120628
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    Also, check that the DNS zone is properly setup. You said it was, but doesn't hurt to check it in WHM > DNS Functions > Edit a DNS Zone area.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. Redirect from https to http problems
    By Frankc in forum cPanel & WHM Discussions
    Replies: 8
    Last Post: 06-27-2011, 09:02 PM
  2. Redirect https to http for non-ssl enabled domains
    By rkula in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 03-21-2011, 02:23 PM
  3. redirect from https to http
    By apfan in forum New User Questions
    Replies: 2
    Last Post: 03-23-2006, 05:58 PM
  4. Redirect Http to Https
    By billau in forum cPanel & WHM Discussions
    Replies: 16
    Last Post: 10-26-2004, 09:12 PM
  5. Redirect http to https://
    By internethosting in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 09-08-2003, 03:55 PM