HTTPS in sub domain redirects to main domain

Posted by Amitabh on Server Fault See other posts from Server Fault or by Amitabh
Published on 2012-10-09T17:20:18Z Indexed on 2012/10/15 9:40 UTC
Read the original article Hit count: 237

Filed under:
|
|
|
|

We recently bought a wildcard certificate and installed it for a domain. It works fine for the main domain but seems to not work at all for any sub domains.

Whats happening is we can access the sub domains fine on HTTP, but whenever we try HTTPS for the same sub domain url we are redirected back to the main domain.

So if I put up a test folder "httpstest" in a sub domain with a index.html file in it, the following happens

mysubdomain.mywebsite.com/httpstest/index.html or

mysubdomain.mywebsite.com/httpstest/ works perfectly fine with http:// but

mysubdomain.mywebsite.com/httpstest/ or

mysubdomain.mywebsite.com/httpstest/index.html does not work with https:// and redirects to the main domain.Any help on this is greatly appreciated.

The site is not the main site used for setting up the VPS. It was added from WHM.

Environment: We are on a Linux VPS.
Cpanel 11.30.6 , Apache 2.2.22, PHP 5.3.13

The Virtualhost entry looks like:

<VirtualHost xx.xx.xxx.xx:443>  
    ServerName my-own-website.com    
    ServerAlias www.my-own-website.com  
    DocumentRoot /home/amitabh/public_html  
    ServerAdmin [email protected]  
    UseCanonicalName Off  
    CustomLog /usr/local/apache/domlogs/my-own-website.com combined  
    CustomLog /usr/local/apache/domlogs/my-own-website.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."  
    ## User amitabh # Needed for Cpanel::ApacheConf  
    <IfModule mod_suphp.c>  
        suPHP_UserGroup amitabh amitabh  
    </IfModule>  
    <IfModule !mod_disable_suexec.c>  
        SuexecUserGroup amitabh amitabh  
    </IfModule>  
    ScriptAlias /cgi-bin/ /home/amitabh/public_html/cgi-bin/  
    SSLEngine on  



    SSLCertificateFile /etc/ssl/certs/my-own-website.com.crt  
    SSLCertificateKeyFile /etc/ssl/private/my-own-website.com.key  
    SSLCACertificateFile /etc/ssl/certs/my-own-website.com.cabundle  
    CustomLog /usr/local/apache/domlogs/my-own-website.com-ssl_log combined  
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown  
    <Directory "/home/amitabh/public_html/cgi-bin">  
        SSLOptions +StdEnvVars  
    </Directory>  


    # To customize this VirtualHost use an include file at the following location  
    # Include "/usr/local/apache/conf/userdata/ssl/2/amitabh/my-own-website.com/*.conf"  


</VirtualHost>`

I guess I messed up the formatting big time. Any help on formatting and on the issue is great appreciated. Thank you.

Update: I could not update the formatting here. I posted the same question in a linux forum . I will really appreciate any pointer on it.

© Server Fault or respective owner

Related posts about apache2

Related posts about ssl