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

How can I forward to //

This is all in 1 virtual host

<VirtualHost *:443>

    Include /etc/apache2/vhosts.d/ssl.conf.include

    DocumentRoot /scripts/htdocs/domain-live


    ErrorLog /var/log/apache2/smartdox-wellpoint_error
    CustomLog /var/log/apache2/smartdox-wellpoint_access combined

    <Directory /scripts/htdocs/smartdox-live>
        Options -Indexes FollowSymLinks Includes
        AllowOverride All
        Order allow,deny
        Allow from all


<VirtualHost *:433>
    Include /etc/apache2/vhosts.d/ssl.conf.include


    RewriteEngine On
    Redirect 303 /
share|improve this question
up vote 0 down vote accepted


ServerAlias *

to the vhost-config.

share|improve this answer

As others have mentioned... you can just accept the other domain as an alias... or you can setup a rewrite rule that will redirect to the correct site name with the alias.

RewriteCond %{REMOTE_HOST}
RewriteRule ^/(.*)$1

If you really don't want the alias... add a 2nd virtualhost with the rewrite rules... and set the servername to the

share|improve this answer

Try putting


after ServerName

share|improve this answer
I use that on another virtual host, so I can't implement it here since I'm looking for a specific solution. – Webnet Dec 12 '11 at 18:25
Could you add ServerAlias This way it will only see that domain and not act as a wild card. – kobaltz Dec 12 '11 at 19:41

Similar to TheCompWiz, I suggest just accepting the conections by adding the ServerAlias.

Instead of redirecting a specific domain, I suggest you select a canonical domain and then use this rewrite rule.

RewriteCond %{HTTP_HOST}   !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)$1 [L,R]

This rule says if the host does not match redirect to

So in your case you would match against your sub-domain.

share|improve this answer

If you want to do such a redirect, probably the best thing would be to set up an additional VirtualHost like this and place a rewrite in it like this:

<VirtualHost *:443>
    Redirect permanent /

To redirect all http requests to https you can use another VirtualHost like this: ServerName ServerAlias

Redirect permanent /

This requires the Apache module mod_alias to be installed and enabled.

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.