Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Attempting to get my site to comply with the limitations of an edge content delivery network, I have been forced to push my security certificate root from to the subdomain . I am now contemplating what seems to be a novel way I can mirror the content from my nonsecured domain through my secure subdomain. Utilizing several mod_rewrite commands in my apache configuration, I have successfully set it up to redirect all https://*.com requests to my server to prefix the request to https://secure.*.com.

Now here comes the part I wanted to invite some discussion on. This is my outline for my idea.

Unlike the rest of my server, any request through the secure subdomain will be handled with a different ErrorDocument for 404 requests. Instead of simply displaying a 404 error, this page will be responsible for trying to find an eligible 'proxy' point on the base domain. Here's an example:

  1. The user requests
  2. The mod_rewrite changes the original request to
  3. The server is unable to find /site/walrus.php in the secure subdomain, and it invokes the 404 handler for the secure subdomain
  4. The 404 ErrorDocument (a php script) strips the secure part out of the requests, rendering again
  5. The script attempts to use file_get_contents() to get the contents of
  6. If the script finds is an existing resource, it echoes the contents of that file as its own contents. Otherwise, having been unable to find the resource, it proceeds to issue redirect headers to the normal 404 ErrorDocument that applies to the rest of the server.

So, what comments can you make about this? Has it already been done before, are there resources or examples of this kind of thing for me to look at while I do this?

share|improve this question

Judging by your question what you seem to want is* -->*

If that's the case why not simply go with the ghetto solution of configuring your web server to handle multiple hostnames (ServerAlias in Apache), point both domains at the same IP, and configure the SSL certificate for

Yes, someone could theoretically hit your main site as and get a SSL error (Certificate Name Mismatch), but this requires no configuration maintenance or gnarly rewrite rules -- it's much nicer for your server.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.