2

What I am looking to do is to redirect all traffic from www.example.com to www1.example.com(subdomain of example.com) via DNS.

I am attempting to move from a local server (example.com) to a GoDaddy server (www1.example.com) which is a VPS, with the intention of completely shutting down the local server after the move. I have successfully moved the site's contents to the subdomain (www1.example.com) and would like to direct all traffic to example.com now to www1.example.com.

The DNS is controlled here locally, not by Godaddy.

I previously tried setting a CNAME record like so: www IN CNAME www1.example.com.

But that failed terribly. Can anyone please provide some insight as to what other solutions there may be?

Would something like this work instead? The IP address 192.0.2.4 would be the IP address of the Godaddy server.

@ IN A 192.0.2.4
www IN CNAME www1.example.com
  • "that failed terribly" means what? – Steve Jul 25 '16 at 23:59
  • 1
    It is not possible to redirect a web page using only DNS. DNS just points the domain to a server. You have to configure a server to do the redirect. A CNAME isn't a redirect. It is just an instruction to use the same server. – Stephen Ostermiller Jul 26 '16 at 0:09
  • It failed terribly in that the site never pointed to the www1 and broke the www site. It looked like all CSS was removed and things were scattered everywhere. I appreciate your feedback. Thank you! – Kani Jul 26 '16 at 13:42
2

You cannot redirect via DNS. That is not what DNS does.

You would have to define www.example.com on your new server and potentially point the site directory to www1.example.com to make what you are doing work.

BUT STOP! Don't do it!

In order for a web server to handle requests, the site must exist on the server. You cannot just point stuff here or there.

I would tell you NOT to use www1 and simply create your site as www or rename it on the new server then update the DNS when ready. This is how it is normally done.

  • And if you want to see your new site while you are working in it, change your /etc/hosts or hosts.txt file to override the DNS on your local computer. – Stephen Ostermiller Jul 26 '16 at 0:11
  • @StephenOstermiller True! However, if you are an old web host like me, you take an old Raq3 and host a local DNS. Cheers!! – closetnoc Jul 26 '16 at 0:13
  • Thanks so much for the feedback! I completely get what you are saying. I was really trying to avoid the down-time but I see that is unavoidable. It's an old Joomla site so I have been using Kickstart to do the move, but in order to use it I have to point to the godaddy server and then run kickstart. So the site would be down while I do that. That's why I had set up the www1 and hoped to redirect to there which I see I could still do as long as the www is set up on the server. I would just need to do the redirect from there. Anyway, thanks again. – Kani Jul 26 '16 at 13:52
  • @Kani Ahhh... I get you now! Best of luck! – closetnoc Jul 26 '16 at 15:45
1

If must control DNS yourself, set up an A record for the subdomain pointing to the IP address of the godaddy server that is all you need assuming you have set up that subdomain at godaddy.

But more to the point, why even bother doing that? Move the content, change the nameservers for www.domain.com (or the IP address if you are using your own child nameserver) and then you don't have to do any redirecting.

Aside: I would be wary of using godaddy, but that is just from my personal experience.

  • Yes, I'm going to take your advice and just avoid the redirecting all together. Appreciate the feedback. Thank you! – Kani Jul 26 '16 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.