Jump to content

How Do I Redirect My Site Using Dns?


shadowmac
 Share

Recommended Posts

I'm moving my website from my school machine (blah.mypc.com) to my own domain (myname.com). I parked myname.com a long time ago and set it as a simple redirect to blah.mypc.com following the instructions at Hostmonster, where I registered it. Now I'm going to convert myname.com to a full site, and I want my personal address blah.mypc.com to disappear as a machine and be nothing but a simple dns redirect to myname.com.



What exactly do I want to ask my school tech people to do (in terms they will recognize)? Do I want a CNAME record created that will permanently redirect all incoming traffic from blah.mypc.com to myname.com? (There is no ftp or email traffic at this address, only http.) If not CNAME, what is it that I should request?



The existing machine blah.mypc.com is one physical machine with a unique I.P.


Link to comment
Share on other sites

It's been my experience that a CNAME for your old site to your new domain name is a really good way to go about it. Here's why:





Pro's:



  • you can leave it there forever and forget about it with little drain on the university resources. (having them serve a refresh web-page or a redirect is probably more likely to get screwed up next time they diddle with their webserver)
  • you can later change the DNS of your new machine around (if you get new IP addresses, for instance) and the university name points to your new domain name regardless of the IP address
  • you can treat the traffic from people who are trying to go to your old name differently. (set up apache on your new machine to serve that virtual host differently, for instance to redirect to your new site with a notice or something of the change)
  • you can serve your site entirely with no redirects or refreshes, which some people claim affect spiders/search engine's rankings of your site. Use apache's ServerName directive to correct the hostname that the browser requested.





Con's



  • if people send mail to you at your old university machine, it may have problems because your MX record may end up being pointed to a CNAME record, which is not strictly acceptable by standards.
  • you may have to set up your new web server to either have this extra virtual host (and treat it just like your new domain name) or to serve pages for any hostname which points to your new IP address (often called a default virtual host, which you can't do sometimes if you're just one virtual host on your hosting company's machine)





There are probably more arguments on each side, but I think that putting in a CNAME record for your old hostname pointing to your new one is the best way to go about it.





Example:



In their dns zone files they have a record similar to the following



blah.mypc.com. IN A 1.2.2.2 










To do a dns redirect using a CNAME record they need to change



blah.mypc.com. IN A 1.2.2.2 to 


blah.mypc.com. IN CNAME myname.com.










The main drawback is that the old URL "
http://blah.mypc.com

" will appear in the browser's address bar.







Hope it helps.



Link to comment
Share on other sites

Thanks wildweaselmi...





Anyway to redirect the queries and keep the links unchanged?





I don't want to loose the google queries or static links that people have from other sites





So if I have



http://blah.mypc.com/forums/mywiseguys-is-awesome.html










I would like it to redirect to



http://mysite.com/forums/mywiseguys-is-awesome.html





What's the best way to do this?



Link to comment
Share on other sites

I just learned that this is a restriction of BIND and not F5 BigIP or even Cisco





The best way to analyze a URL is in four parts





scheme (http, https, etc.)



hostname (mywiseguys.com)



path (/forums/gallery/)



query (#entry620)





BIND DNS can address only the hostname portion of this where a load balancer pretty much doesn't have much for limitations.



Link to comment
Share on other sites

 Share

×
×
  • Create New...