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 want to redirect all requests from to

Preferably, this should happen at DNS level. I tried using PTR records, but that simply fails, returning a 404. is an ALIAS for an Elastic Load Balancer.

What’s the simplest way to achieve this?

share|improve this question
What did you try with PTR records? I'm curious. – TRiG Feb 18 '14 at 14:25
@flavian the poster asked for a DNS rewrite, not a URL rewrite, and he specifically said that he did not care how the URL looked like. – pauska Feb 18 '14 at 14:36
@flavian for f sake, you said that you want to do the redirect in DNS. My answer explains how to do it in DNS. If you want to redirect the URL then you need a URL rewrite. It has nothing to do with DNS. – pauska Feb 18 '14 at 14:40
Is there any particular reason for doing that? I'd do it the other way around. – nyuszika7h Feb 18 '14 at 19:43
SANs in EV SSL. – flavian Feb 18 '14 at 19:47
up vote 14 down vote accepted

If you're already using Route 53, you can use their proprietary alias "record" to solve this problem. With standard DNS, you cannot do this at all and you have to have a web site send a 301 redirect. Of course, you still need to send the 301 redirects or deal with the fact that some requests will come in without the www (though you should send 301s for SEO reasons).

Probably the easiest way to do this is to set up an S3 bucket with the name of the naked domain and configure the bucket properties to redirect from to, and then in Route 53 create an alias for the naked domain name that points to that S3 bucket.

share|improve this answer
It works, many thanks. – flavian Feb 18 '14 at 15:24
Thanks @MichaelHampton this is VERY helpful. I'm still having a problem tho. Now when I try to access my domain using HTTPS directly it wont work. – Eki Eqbal Feb 12 '15 at 1:28

For a DNS alias you simply need to add a CNAME or A record in DNS. See my answer here: How do I redirect www to non-www in Route53?

For URL-rewriting (as in redirecting the clients to another address) then you need some form of URL rewrite logic done at the webserver. There are several ways of doing this, and it depends on what kind of webserver you use. The most popular is using mod_rewrite with apache. This site is riddled with mod_rewrite questions, a few searches should get what you want.

share|improve this answer
I used CNAME on my internal bind9 srv exactly an hour ago, but results are not the same as with url rewrite. When entering this CNAME into the browser address bar, you get exactly that URL, it doesn't change to the url which CNAME points to. I'm using apache mod_rewrite now, sending 301s when there's no www. prefix. – Kitet Feb 18 '14 at 16:49

AWS Route53 doesn't currently provide support to redirect what's currently known as an APEX record (the root domain) to another domain name, although they're working at a solution.

I've achieved this by creating an A (alias) record which points my root domain ( to the IP address of my WP hosted solution...And the answer is yes, if the IP changes then you'll need to change the alias. However the provider guaranteed me that the IP is fixed unless they need to perform some sorts of disaster recovery and change the hardware in which case they will put a proxy together to perform the redirections while giving the customers 45 days to change their mapping.

share|improve this answer
A does not mean alias, it means address. And you can easily do a redirect with Route 53 using the S3 bucket method shown above. – Michael Hampton Feb 26 at 6:20

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.