Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

We have a Wildcard SSL Certificate that is supposed to work on any subdomain of a given domain.

So in this server we have this file structure:

/home/DOMAIN/public_html/subdomainx /home/DOMAIN/public_html/subdomainy etc...

Now, the Certificate is installed, but when you visit any subdomain over https (example: hxxps:// ) it points to


We need that when you visit a subdomain via https hxxps://

That it points to the the same directory that it's http equivalent: /home/DOMAIN/public_html/subdomainx

Our provider tells us that this is not possible, that the current behaviour is correct, and that to achieve this we need to do it with htaccess.

I've tried a few things, incluiding this solution, that seems to be what I need:

But can't get it to work.

Any tips? Thanks.

Added: The server is Apache.

share|improve this question
The wildcard SSL in this scenario isn't that important, other than to prevent the browser from complaining. The question you're really asking is how to redirect requests to the proper directory. You'll have to tell us what web server you're using and show us the relevant part of your configuration. – cjc Apr 3 '12 at 19:51
Server is Apache. Right now the .htaccess is empty. I'll try to reproduce what we tried and add it later. – Ericko Apr 3 '12 at 20:41
In case it isn't obvious, the "relevant parts" cjc is talking about are the vhosts with the ServerName, ServerAlias and DocumentRoot directives in them. All of them. – Ladadadada Apr 3 '12 at 22:18
up vote 0 down vote accepted

Make sure you have the properly configured in your vhost folder.

This file should look like this:

<VirtualHost *:443>
DocumentRoot /home/domain/public_html/subdomain
BytesLog domlogs/domain-bytes_log
CustomLog domlogs/ combined
#ScriptAlias /cgi-bin/ /home/domain/public_html/cgi-bin/

User domain
Group domain

suPHP_ConfigPath /home/domain/etc/

SSLCertificateFile /opt/apache/conf/ssl.crt/
SSLCertificateKeyFile /opt/apache/conf/ssl.key/
SSLLogFile /var/log/ssl/domain.com_log
UserDir public_html
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown


share|improve this answer

I'll bet that you're in need of a NameVirtualHost *:443 (or however your vhosts are defined).

Another option would be to define a VirtualDocumentRoot, if your vhost configs are all identical except for the docroot.

.htaccess files are definitely not required for anything that you can do with Apache - with the exception of "use htaccess files".

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.