0

I want to forward my root domain(yourdomain.com) to www.yourdomain.com Should I delete the A record of the root domain and then setup 301 permanent forwarding to www.yourdomain.com?

I am hosting my app on heroku. So I don't really have an IP address to setup an A record.

The thing is I first deleted the A record of my root domain and then forwarded it. I pinged it and here is the result -

ping yourdomain.com
ping: cannot resolve yourdomain.com: Unknown host

Update and some more information - I am hosting a static website. And managing the DNS on cloudflare.com I added an A record for yourdomain.com -> 184.168.221.51 Just an random IP.

2 Answers 2

0

Ask you DNS provider whether they can set up a 301 HTTP redirect from yourdomain.com to www.yourdomain.com. Several DNS providers do this for free in their own webserver.

CloudFlare can solve HTTP redirect too: https://support.cloudflare.com/hc/en-us/articles/200172286-How-do-I-do-url-forwarding-with-CloudFlare-

Or you can use wildcard domains names:

* CNAME yourapp.heroku.com

Heroku has a quite good description about the different solutions: https://devcenter.heroku.com/articles/custom-domains

2

if you remove A record, then you won't be able to setup your 301 redirect, you should put it back and do 301 within your web server.

* UPDATE *

by pointing A record to "random IP" won't really solve anything, UNLESS you manage a web server on that random IP and can set 301 redirect there (which I'm sure you have no control over it) so solution is simple here, point A record to RIGHT IP address and then setup your 301 redirect.

3
  • I am hosting my app on heroku. So I don't really have an IP address to setup an A record.
    – user182332
    Oct 17, 2013 at 16:34
  • @user182332 First, that's important information, and really something you should have told us in your question. You should edit it your question to include that information.. Second, without some DNS entry for yourdomain.com you can't do anything on the web server level (like a 301 redirect). If you can't create an A record for that domain, you can't do what you want.
    – voretaq7
    Oct 17, 2013 at 16:45
  • I just edited the question! Some more information: I am hosting a static website. And managing the DNS on cloudflare.com I added an A record for yourdomain.com -> 184.168.221.51 Just an random IP.
    – user182332
    Oct 17, 2013 at 16:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .