I am currently hosting my website at home using xampp and a DynDNS account. everything is working great and I have worked hard to get good Google results. Unfortunately, I need to change my domain name of my site. I have read several articles and know there are several ways of doing this, but I am just wondering which one is the recommended way of doing so? One way I figured I can do this is to just point my old and new domain name to the same ip address of my computer I am hosting from (i believe my DynDNS account lets me do so). The other way, which appears to be the better way but not sure, is to use a 301 redirect. If I were to go this route, how exactly do i set it up? I understand that it is basically just putting a line of code in the header of the old site which directs it to the new one. This is fine and all, but brings on the question of, am I technically hosting 2 sites on my computer now?
I would have www.olddomain.com pointing to my ip of my computer with basically a blank index.html with the redirect header redirecting it to www.newdomain.com which would also point to the same ip of my computer. If this is the case, how would I, technically speaking, host those 2 sites from one computer? An additional question is do I just place the redirect code in the index.html or do I place it in every page of the site and redirect it to the same page on the new domain? If the process of using 301 redirect is different from what I am assuming then can someone please elaborate on exactly how to use it in my situation?