Heroku/GoDaddy: send naked domain to www [closed] - redirect

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am trying to figure out how to get the naked domain for my website to redirect to the www domain. I am using Heroku and have the domain from GoDaddy. Because of Heroku, my A records are already set up as:
#: 75.101.145.87
#: 75.101.163.44
#: 174.129.25.170
And my www CNAME points to proxy.heroku.com.
I've been looking all over the internet, but can't find a simple, free answer for how I can do this redirect. Some answers discuss using paid services, which I don't want to do, and others talk about going in and modifying Heroku settings, but then don't really give much explanation. Right now, if you go to my naked domain, it's just Heroku saying that no such app exists, while if you go to my www domain it's my app.

On GoDaddy, use the "Forwarding" feature to setup a forward from yourdomain.example to www.yourdomain.example. The forwarding feature can be accessed in the Domain Manager at the bottom of the "Domain Information" section:
If you do this then all traffic to yourdomain.example will be routed to the Heroku app CNAME (which is the better approach).
One note, however, if you are on the Cedar stack then don't use proxy.heroku.com for the host of your www CNAME. Instead use your-app-name.herokuapp.com. These details are covered here.
GoDaddy also specifies that in order for your domain name to forward, its A record must be pointed to 64.202.189.170 or must fall between the following ranges: 50.63.202.1 - 50.63.202.31 or 184.168.221.1 - 184.168.221.31.

You could also use http://wwwizer.com to forward from your naked domain to your www. In GoDaddy in the DNS manager under the A record in the # heading type in 174.129.25.170. They will automatically redirect from the naked domain to one with www. in front of it.

In GoDaddy's DNS Zone Editor, you will want to configure your CNAME record www to point to #. In your A Record, you'll use a wildcard (*) to point to the IP address and a second A Record that uses # as the host that will also point to the web address. This way,
subdomain1.example.com will forward to your IP
www.example.com will forward to your IP
silly.example.com will forward to your IP
anything.example.com will forward to your IP
Frequently Asked Questions
Can I point *.mydomain.example to my Heroku app?
Yes, using the free Custom Domains feature of Heroku you can point a wildcard domain to your application.
What IP addresses should I use to point my custom domain to Heroku?
The Heroku routing stack uses a collection of IP addresses that can
change at any time, and using A records to point to your app is not
supported. To ensure your domain always points correctly to the
routing mesh, configure subdomains (e.g. www in www.example.org) using
a CNAME record:
If the app is on… Then CNAME the subdomain to
Bamboo yourapp.heroku.com
Cedar yourapp.herokuapp.com
Naked (or bare/apex) domains (e.g. example.org) should be avoided
because of their availability and uptime consequences.
Why can't I add subdomain.mydomain.example for my app?
In some cases, attempts to add a custom domain (like
subdomain.mydomain.example) for an app may result in an error like this:
! mydomain.example is owned by another user
All applications for a given base domain must be owned by the same
Heroku account. The above error means that someone else has already
added a mydomain.example custom domain to one of their apps.

If you have the IP addresses setup on your naked domain and your www cname'd to yourappname.herokuapp.com then all you need do is use something like RackRewrite in your application to redirect the requests when they arrive at your application.
What you want to setup is any request to the naked domain gets redirected to your www address. After following the installation instructions add an initializer in config/initializers
ApplicationName::Application.config.middleware.insert_before(Rack::Lock, Rack
r301 %r{.*}, 'http://www.yourdomain.example$&', :if => Proc.new {|rack_env
rack_env['SERVER_NAME'] != 'www.yourdomain.example'
}
end if Rails.env == 'production'
Which is saying, if the requested URL is not www.yourdomain.example then 301 redirect it to the www.yuordomain.example but only if it's running in production.

For this to work with Network Solutions do the following:
Network Solutions pointing yourdomain.example to www.yourdomain.example.
Here's how.
Within Account Manager, select My Domain Names
Select the domain name that you want to manage
In the green box, select Change Where Domain Points
Select Advanced DNS, then Continue
First, edit the A Records by selecting Edit A Records
*For the "# none" enter the following IP address 205.178.189.129, clear the records for the "www" and " (All others)"**,
then select Continue
Second, edit the Host Aliases (CNAME records) by selecting Edit CNAME Records
Enter "www" in the Alias column
Leave TTL set to 7200 but on the same line, enter the name servers provided by the blogging service in the Other Host section
[ IE
FOLLOW THE HEROKU INSTRUCTIONS NOW www --> yourapp.herokuapp.com (Cedar Stack) ]
Select Continue
Now wait and check the domain(s) with the following terminal command:
host domain.example
host www.domain.example

Related

Redirect my weebly site to my heroku app

I recently acquired a domain while buying a logo and some business cards through logomaker.com. I took this opportunity to claim the domain that I want to use for my rails app on heroku (Was this a mistake?).
Currently I seem to be required to use Weebly to edit the site for this new domain (But I'm thinking about transferring the domain to my GoDaddy account for simplicity. Is this a good idea?) I'm trying to route the simple domain to my rails app. In other words, I want users to be able to type mrzschool.com and get routed to mrzschool.herokuapp.com. I haven't been able to find a way to do this through Weebly.
I also have access to DNS and nameserver settings, such as imap and pop, through logomaker.com. This seems like it might be a way to change the routing, but I'm realizing that I'm unschooled in the realm of domains and DNS.
I'd suggest you go through the the process of moving your domain registrar from logomaker to your goDaddy account, were you can keep an eye on this domain along side any other domains you've there. It's a tedious process but worth it in my opinion. However, it's optional since you have all the control you need to do that via logomaker.
The heroku docs mentions (found here) how you can point your own custom domain to your heroku app subdomain. Keep in mind that you will need to verify your account and your ownership of the domain.
You will also find some useful troubleshooting steps here.

How to point some, but not all of domain to a different nameserver

My client's domain registration is with Network Solutions, but the files, ftp and cPanel for their current site are with another company and are not accessible to me.
We are building a new site at a different domain name and will point the old url to it. The complication is a section of the old site that the client wants to remain at the current url for the next 5 months.
In other words, I want to redirect current-site.com to new-site.com, except for everything in current-site.com/one-section/ which needs to be viewable at that old address.
How can this be done?
If I'm not mistaking this is what you are looking for. I have done it in Godaddy using this instruction on the link which it will hopefully give you a better idea on how to do it. It's a very easy process. You can find the IP of the website you want to redirect to on the left side fo the cpanel or you can do it via command line entering the following: on windows click win key + R type cmd inside of cmd type ping and the address e.g ping www.google.com
https://www.hostmysite.com/support/legacy-control-panel/dns/domain_point/

Naked Root Domain Hosting

The usual approach calls for pointing mysite.com to www.mysite.com.
But suppose that I would like not to redirect. In other words, I would like to set up a naked root domain, without setting up any sub-domains, not even www.mysite.com.
I am using Route53 and S3. Presumably I would need just one hosted zone (mysite.com). Do I still need two buckets (mysite.com and www.mysite.com) or can I set up just mysite.com?
Set up the bucket, named for your domain name. The bucket name has to match exactly the address that shows in the browser's address bar.
Then, create an A record at the root (apex) of the domain in Route 53, leaving the hostname empty, selecting "Yes" for Alias, then select the bucket in the drop down list.
That is all you have to do.
If you create a "www" CNAME pointing to the domain name itself, this will not work with S3 web site hosting, because the bucket name won't match what's in the address bar of the browser (and a CNAME does not cause the browser to change the address bar to the target).
Everything in DNS that points to S3 must have a corresponding bucket that matches the DNS entry. That's how it was designed.
Because people are often very prone to typing "www" in front of web site hostnames, you probably should create a second bucket with "www."+your domain name as the bucket name, then configure that bucket to redirect all requests to the root domain name, and set an additional Alias record on S3 -- because that way if a user types "www.example.com" into their browser, it will hit the second bucket and redirect -- by changing the browser's address bar -- to the root domain... which almost certainly is what you actually want, from a usability perspective.
Edit after some testing on one of my extra domains. The information
posted below is incorrect. I'll leave this here so others don't follow down this incorrect path.
--------------------------------
That's what CNAME records do for you. Just add a CNAME for 'www' that goes to yourdomain.com
Both www.yourdomain.com and yourdomain.com will work in the browser without any redirection.
in Route53 it will look like this.

How to redirect a root (naked) domain to www - heroku and zerigo

I have a domain example.com and www.example.com. I'm using Heroku and Zerigo for DNS.. Right now I have a forwarding from the root domain to the www.example.com from my Hostgator account but that's not working. I'd prefer to use Zerigo with the redirecting or by using an ALIAS. A lot of the articles I've found talk about ALIAS and ANAMES but I can't find those on Zerigo unless an ALIAS is specified by the letter A.
Does anyone have a solution to pointing naked domains to their www using Zerigo??
I have done this already -
Went to Zerigo dashboard
Clicked Add Snippet
Click Heroku
Add both of those
Change the CNAME to my heroku app name
It seems like this makes it work temporarily only.
Heroku support didn't even give me a great answer at all...
Looks like one short-term solution would be to point an A-record to 174.129.25.170
If you go to http://wwwizer.com/naked-domain-redirect they free-of-charge redirect naked domains to full domains if you point the record to that address. Also, instead of using Zerigo I did this on my domain registrar's website. But using Zerigo should work as well.
Hope this helps anyone who has this trouble in the future. Remember, this isn't the best solution but it does work. If anyone has a better answer please let us know for future reference.
EDIT on April 10, 2014
The best solution is to buy an SSL certificate for your website. With Heroku, you can use their SSL Endpoint add-on which requires you to buy a certificate elsewhere. This isn't the easiest process, but will work 100% of the time.
Happy coding

Google Apps: verify domain ownership using CNAME

I understand CNAME is an alias to another record. Since I am using melbourneIT for my domain name, when I set up Google Apps, I need to verify my domain name ownership through CNAME record change.
However when I see page: http://support.google.com/a/bin/answer.py?hl=en&answer=142005#CNAME (please tick "I want to verify using a CNAME record"), I am totally confused at what information to use in order to create the CNAME record for this verification purpose.
Please see below for the information from http://support.google.com/a/bin/answer.py?hl=en&answer=142005#CNAME:
Host Name/Alias Value/Destination
Custom URL: www ghs.google.com
Verification: googlefffggghhh12345 (your unique string) google.com
If my domain name is mydomainname.com, what should I put into my CNAME record (the value for HOSTNAME and POINTS TO, as in my DNS management panel shows)?
It's confusing because it looks like two entries. I think you want to use the second set of criteria for verification. So you'd enter the googlefffggghhh12345 as the alias(or host), and it would point to google.com.
You might want to do both or alternatively do mail as a cname and point it to ghs.google.com. You'll want to do that eventually anyway.
The cname, www pointing to ghs.google.com, is consistent with telling your domain host to check to see if there's a webpage setup in google sites and send people there. If there isn't one, and there isn't a sitemap within apps for one, I think the domain would just return to current hosting.