Is it possible to set a DNS record to redirect all example.com/*
traffic to www.example.com/*
?
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.
Best Answer
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 www.example.com you will have to do it in the app using the rack rewrite tip you linked to.