Jump to content

Recommended Posts

I'm trying to set up a subdomain for the first time. Something is happening with the URL resolution that I don't understand.

 

The directory structure looks like this:

 

serverRoot

      home

            accountRoot

                  subdomainRoot

                        public_html (subdomain document root)

                              include (subdomain's include files)

                  public_html (domain document root)

                        include (domain's include files)

 

When I load subdomain.domain.com, it works.

 

When I load http://subdomain.domain.com, it works.

 

When I load https://subdomain.domain.com, I get an error. By fiddling with the source code, I've determined that the server is actually loading index.php from the root domain instead of the subdomain.

 

The only cause I can think of for this is a rewrite rule, but I think I've eliminated that possibility. There are no rewrite rules that could match https://subdomain.domain.com. Furthermore, the rewrite rules for https and http are exactly equivalent, so any rule that affects one should affect the other. And finally, the effect of a rewrite rule should be visible in the URL shown in the browser's address bar, but it isn't changed.

 

I'm looking for ideas here: what might be wrong?

Please post your configuration and the rewrite rules.

People cannot help you without knowing what you've actually tried to do, after all. What you've posted above was what you wanted to accomplish, and what happened, not what you've actually done.

Unless you have SNI enabled in Apache and have a browser modern enough to support it (which I believe almost all of them do by now), there can be only one website served through HTTPS. In your case that would be your "root domain".

 

Best option is to get SNI working, but you need Apache 2.2.12+ and control of the server and/or software. Otherwise you'll have to emulate the subdomain through mod_rewrite.

If you have reason to believe that the problem is in .htaccess, certainly you need to see it. Here it is; I've done substitutions on the domain names to make them consistent with the OP.

 

Options +FollowSymlinks

RewriteEngine on

rewritecond %{http_host} ^http://production\.com [nc]

rewriterule ^(.*)$        http://www.production\.com/$1 [r=301,nc]

rewritecond %{http_host} ^https://production\.com [nc]

rewriterule ^(.*)$        https://www.production\.com/$1 [r=301,nc]

rewritecond %{http_host} ^http://domain\.com [nc]

rewriterule ^(.*)$        http://www.domain\.com/$1 [r=301,nc]

rewritecond %{http_host} ^https://domain\.com [nc]

rewriterule ^(.*)$        https://www.domain\.com/$1 [r=301,nc]

 

("domain.com" is the domain on which I'm having this problem, a domain used for QA. "production.com" is the corresponding production domain. The file contains references to both only so that I can use a single version of the .htaccess file in both.)

 

The limitation of one certificate per domain sounds likely to be the problem, though. If so, I can eliminate it by moving the site to another domain name, which probably won't be a big deal. I'll contact the client to ask if I can use one of their parked names.

I'm not sure which version of Apache is installed; phpinfo doesn't say, and I haven't had time to research it otherwise.

 

If the version of Apache doesn't support SNI, replacing it is not an option. It's on a managed server, and neither my client nor I would be prepared to roll our own.

Right. My point was that you can use that subdomain just fine so long as it resolves to and ends up at a second installation of Apache (of whatever version you want). Don't need to bring in something else.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.