Web Analytics Made Easy -
StatCounter Wildcard SSL Woes - CodingForum

Announcement

Collapse
No announcement yet.

Wildcard SSL Woes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wildcard SSL Woes

    Hi Guys,
    So I've recently bought and installed a wildcard SSL on my server which governs domain.com and any subdomain that I add to it.

    In essence, the cert works fine. For example, if I set up a static 'hello world' PHP page and set the domain to sub1.domain.com, the page is displayed in both HTTP and HTTPS (with some mod_rewrite which I'll come to shortly).

    The issue is that the domain is serving applications, which all kind of need their own document root to function properly.

    If I print_r the $_SERVER array outside HTTPS, I see the correct document root - something like:
    /home/domain.com/public_html/_apps/sub1/
    That would be the doc root for sub1.domain.com

    If I then switch over to HTTPS and again, print_r the $_SERVER array, I get:
    /home/domain.com/public_html

    It seems to be completely ignoring the docroot for that subdomain. The current mod_rewrite I'm using in the docroot of the base domain is:

    Code:
    RewriteEngine On
    RewriteCond %{SERVER_PORT} ^443$
    RewriteCond %{HTTP_HOST} ^sub1\.domain\.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/_apps/sub1/
    RewriteRule ^(.*) /_apps/sub1/$1
    This is required to get the wildcard SSL working across multiple subdomains. Without this, switching to SSL just reverts to the base domain.

    Does anybody know if/how I can maintain the document root from normal HTTP inside HTTPS and stop it changing the document root to that of the base domain when running through HTTPS?

    Cheers
    Pete

  • #2
    Hey Pete,

    What does your VirtualHost setup look like, do you just have the one default Virtual host that is catching all requests?

    Comment


    • #3
      Originally posted by Cags View Post
      Hey Pete,

      What does your VirtualHost setup look like, do you just have the one default Virtual host that is catching all requests?
      Hi Cags,
      My VirtualHost setup looks like this:
      Code:
      <VirtualHost XXX.XXX.XXX.XXX:80>
          ServerName sub1.domain.com
          ServerAlias www.sub1.domain.com
          DocumentRoot /home/domain/public_html/_apps/sub1/public_html
          ServerAdmin [email protected]
          UseCanonicalName On
          CustomLog /usr/local/apache/domlogs/sub1.domain.com combined
          CustomLog /usr/local/apache/domlogs/sub1.domain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
          ## User wunderap # Needed for Cpanel::ApacheConf
          <IfModule !mod_disable_suexec.c>
              SuexecUserGroup wunderap wunderap
          </IfModule>
          ScriptAlias /cgi-bin/ /home/domain/public_html/_apps/sub1/public_html/cgi-bin/
      </VirtualHost>
      No, there is one virtualhost entry for each subdomain.

      Thanks
      Pete

      Comment


      • #4
        It might be worth taking a look at this...

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎