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

Is it possible to set a DNS record to redirect all* traffic to*?

I'm running a Sinatra app on Heroku's Cedar stack.

I set up Heroku's Custom Domains addon, and the documentation discusses Redirecting Traffic to a Specific Domain. I also read about how to do this with Rack Rewrite. However, I'm wondering if there's a way to do this via DNS, i.e., without hitting my app.

share|improve this question

migrated from Oct 10 '11 at 4:53

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

up vote 4 down vote accepted

There is no way to do what you are asking for in DNS.

DNS simply resolves a hostname to an IP address there are no 'redirect' features

If you want users to only use your app via you will have to do it in the app using the rack rewrite tip you linked to.

share|improve this answer

Assuming you're okay with changing your DNS servers, you can use DNSimple's "URL" DNS type. This will take care of your issue this at the DNS level.

It is mentioned in this Heroku article on Avoiding Naked Domains.

share|improve this answer

If you are on heroku the simplest way is a wildcard domain

heroku addons:add custom_domains:wildcard

This will redirect all subdomains *, including www to

If you have root access to your name server you must add:

www   IN    A 


*     IN    A

for a wildcard where is your IP, or

www   IN    A
*     IN    A

if you have an unknown/dynamic IP

share|improve this answer

If you use Google Apps, they have a feature that allows you to redirect your naked domain (

You simply add their servers as A records in your DNS.

Look in the Domain Settings of the Control Panel.

The URL should be like below. Just replace with your domain.

share|improve this answer

Short answer: Point your "naked" domain record to

Long Answer: The is offering free redirection service. It redirects to whatever domain you attempted to go, just appending "www." before it. There is FAQ at for those interested in details.

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.