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'm using Amazon Web Services to host my site and since I am going to use the ELB service I will need to redirect all my traffic from to

Is this possible through the DNS?

I am using Route 53 as my DNS. Any hints would be appreciated.

share|improve this question

migrated from Mar 2 '11 at 19:09

This question came from our site for professional and enthusiast programmers.

Given the protocol identifiers in your URLs, you can already see that it is impossible. You want two completely unrelated protocols in ways they have not been designed for ;) – 0xC0000022L Mar 2 '11 at 19:33
up vote 12 down vote accepted

You cannot do redirects in DNS.

Instead, you need an HTTP server that sends HTTP 301 redirects in response to requests for
Most registrars offer redirect servers; consult yours.

share|improve this answer
Indeed my registrar offers a free redirect service. Thank you! – Alex Mar 2 '11 at 19:42

Even quicker than organicveggie that doesn't require mod_rewrite (but what fun is it running Apache without mod_rewrite?) is that you can just redirect directly from your site config. This requires no webroot to be created at all. This should go within your <VirtualHost *:80> section for this site:

ServerAlias *.mydomain.* myotherdomain.* *.myotherdomain.* yetanotherdomain.*
Redirect 301 /
share|improve this answer

To supplement SLaks response, a common way to handle this is to use mod_rewrite in Apache and send a 301 redirect. In other words, let ELB send the traffic to an Apache server running on your EC2 instance. Then have Apache send a redirect if the hostname does not include www.

Here's a sample snippet:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^
RewriteRule ^/(.*) http:/$1 [R,L]

Hope that helps.

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.