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

I am trying to setup a website where we would like to redirect the URL for a couple of different cases. The cases are below:

  • If port 80 then force port 443
  • If URL = then force URL =

We would like to first require all traffic to be on HTTPS and then require that one of our domain's when requested (since it resolves to the same box and due to our SSL certificate) is redirected to another one of our domains. We are able to get the force SSL to work, but we cannot seem to find a mod_rewrite rule that will work when is requested to force it to

Any help that you can provide would be greatly appreciated. Thanks in advance.

share|improve this question
up vote 2 down vote accepted

You've done the force SSL so ignoring that.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^support\.example\.com$
RewriteRule (.*)$1 [R=301,L]

share|improve this answer
Did I just delete your comment by accident? Apologies if so. I'm going to assume you did it but if not let me know :) – James L Dec 18 '10 at 0:39
I am not able to get that set of rules that you listed to work. It does not seem to redirect. If I start out with then I am not redirected to I have added the rules that you listed to my SSL virtual host. I am not sure where to go from here. – John Dec 18 '10 at 0:47
It works for me inside a .htaccess - I have the following in the .htaccess for * and it redirects RewriteEngine On RewriteCond %{HTTP_HOST} ^test\.jdlawrie\.co\.uk$ RewriteRule (.*)$1 [R=302,L]. Did you ensure you got your <Location> tags in the vhost file? Paste the configuration and I'll try to help. – James L Dec 18 '10 at 0:51

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.