3

I'm moving to a new web host, so totally new IP. At the same time, I want to change my domain name from xyz.org to xyz.net (it's a non profit website that several hundred people use, but there's no organization. It's just me, so the '.org' is a bit of a misnomer). If people continue to go to xyz.org, I'd like them to be automatically redirected to xyz.net. Also, I'd like a way to detect, via server-side php or javascript in the client browser, that they've been forwarded and put up a message like 'Yo dude, start using the new URL: xyz.net'

I'd prefer to do all this while not having to pay to the original webhost to keep my xyz.org site running so it can forward users using traditional http forwarding methods. So can this forwarding be done any other way? Can a DNS registry service do this forwarding for me? Suggestions?

1 Answer 1

4

This is all quite straight forward.

  • Register your new domain and get the site going at the new host.
  • Add the old domain to the DNS on your new host.
  • Change the nameservers on the old domain to your new host
  • At your new host add a redirect from the old domain to the new domain

There are numerous ways of detecting that the visitor has come via the old domain. Coding is off topic on this site, but if it were me, I would redirect the old domain to xyz.net?redirect=true (or whatever suits you) and then on the new site using PHP parse the querystring and act accordingly.

7
  • I am a little confused by your answer. This requires that sites example.org and example.net both are created and hosted as websites where one is redirected to the other. DNS cannot redirect anything. (I assume you know this, just stating it for the OP.) However, if a catch-all site, the first site created on the server, exists then it is possible to use the catch-all site to capture all unknown traffic and redirect it to the preferred site. This assumes that the OP is not one of many sites on a shared server. Cheers!!
    – closetnoc
    Oct 9, 2017 at 2:44
  • @closetnoc - where do you see that I am suggesting DNS does the redirecting? Not at all. It would be a .htaccess redirect. That's why I suggested getting the old domain's DNS to the new host.
    – Steve
    Oct 9, 2017 at 2:48
  • I am not. I was just putting it in with the assumption it could be possible the OP may be thinking that is what you meant. It was a JIC/CYA statement for the OP. Sorry for the confusion. What is most important is that the OP know that both sites have to exist on the webserver in some form. Cheers!!
    – closetnoc
    Oct 9, 2017 at 3:39
  • @closetnoc where would we be without confusion?
    – Steve
    Oct 9, 2017 at 4:02
  • 1
    I would probably be at home watching TV instead of wandering the streets of the next town wondering where my house went!
    – closetnoc
    Oct 9, 2017 at 4:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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