ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

New site to replace old, DNS question?

January 17, 2011 4:17am

Subscribe [3]
  • #1 / Jan 17, 2011 4:17am

    Embody_Bruce

    76 posts

    Would this work?

    I’m translating quite a large static HTML site to EE. At some point in this process there needs to be a painless switch from one site to the other. So far with EE I’ve only designed new sites, I haven’t done one to replace an existing site. What I’m planning to do is this:

    Take some space with a new host, a webfusion VPS. Build the site there, viewable in development at a URL that looks a bit like https://101.104.92.137:8443/sitepreview/http/DOMAINNAME
    And then get the DNS to switch from the old host to the new one?

    Will that work? What issues might come up as I develop the new site? Will all the title_permalink and/or comment_url_title_auto_path still work after the changeover?

    Probably a simple question but I don’t want to get months down the road and find I’ve made a mistake.

    Thanks.

  • #2 / Jan 17, 2011 9:13am

    handyman

    509 posts

    I think you can do something like this which might work out better.

    Edit the hosts file on your PC to temporarily make it so that the real domain name is at the new server. That way you can test the setup using an actual domain name. If the site is not incredibly busy, you can do a basic test and then switch over and fix the little things….and there are usually little things!

    Here is how to edit hosts on a mac
    http://www.mactricksandtips.com/2009/02/editing-a-macs-hosts-file.html
    and windows
    http://vlaurie.com/computers2/Articles/hosts.htm

  • #3 / Jan 17, 2011 4:45pm

    Jack Scott

    18 posts

    I agree with Handyman, editing your PC’s hosts file is much better than relying on your webhost’s preview function.  If your clients are reasonably tech-savvy, they can edit their hosts files as well to help with testing.

    When the new site is ready to go, ask your web hoster to change the DNS Time To Live (TTL) setting for the site to something short, like 5-10 minutes.  Give the TTL changes a day or two to propagate out, then update the DNS to point to the new site.  The short TTL allows browsers to see the new site quickly, and lets you switch back quickly if you run into problems.  Once the site move is complete, you can reset the TTL back to the defaults.

  • #4 / Jan 28, 2011 5:43am

    Embody_Bruce

    76 posts

    Things have developed a bit on this job and my question has changed slightly. I’m going to transfer the existing static site onto the new VPServer so it’ll be visible at http://www.domain.com

    What I’m then planning to do is develop the new site on a sumbomain new.domain.com and when it is ready to go live do some DNS trickery (that a server guru once did in a similar situation on another job once-upon-a-time) so that http://www.domain.com points to the new content and the existing site gets archived but still visible at another subdomain old.domain.com

    But I’m not sure how to change to achieve this. I have access to the DNS records and can successfully change them. I can setup subdomains and create content on them. What I can’t seem to do is get http://www.domain.com to change from seeing the existing content to the new stuff? Is there a simple DNS change to make or is it really a matter of copying the sites from one subdomain to another, not sure EE would like that?

  • #5 / Jan 28, 2011 12:21pm

    Jack Scott

    18 posts

    Are the two sites on different servers (or different IP addresses)?  If so, you can set up the new site’s virtual host to respond to both new.domain.com and http://www.domain.com.  You can create a DNS A record for new.domain.com with the new server’s IP address, but keep the DNS A record for the http://www.domain.com pointing to the old server’s IP address.  When the new site is released, all you need to do is change the DNS A records for http://www.domain.com (and domain.com) to point to the new server’s IP address.  If you need to keep the old content online, you can use the hosts file trick described previously, or create a DNS A record for old.domain.com pointing to the old IP address and modify the old site’s virtual host to respond to old.domain.com.

    The problem is a bit easier if the sites are on the same server.  I would set the new site up as a separate virtual host responding to new.domain.com only.  When you’re ready to go live, just change the new site’s virtual host to respond to http://www.domain.com and change the old site’s virtual host to respond only to old.domain.com.

  • #6 / Jan 31, 2011 4:13am

    Embody_Bruce

    76 posts

    Thanks Jack

    The two sites are on the same server which is a linux VPS. It doesn’t give me any options to create virtual hosts. I’ve tried testing the following but it isn’t working.

    I’ve set up two subdomains old.domain and new.domain (and there is also the default file that www seems to point to); so there are three domains. What I want is do is get http://www.domain to point to old.domain whilst I develop new.domain and then switch that pointing over later.

    All I can do at the moment is get www to point to the default page that came with the hosting. If this is going to work I can see three DNS records that I can alter, old, new and www. How should they be configured? As A records, CNAME records and if CNAME, what should they point to?

  • #7 / Jan 31, 2011 4:29pm

    Jack Scott

    18 posts

    If you have shell access to the server, you can use symlinks to handle the switchover.  You’ll need to configure your webserver to allow symlinks and create source directories for the old and new sites outside the webserver’s docroot.  Once that’s done, you can symlink the www site’s docroot to either the old or new source directory.  Changing the site is as simple as changing the symlink.  We use this trick in our release system, it lets us update a site with no downtime.

    I’m assuming your hosting provider sets up subdomains as separate virtual hosts; that’s how Plesk and HSphere do it.  Other hosting providers give you a single virtual host and rely on rewrite rules for handling subdomains; the symlink trick should be possible in that case, but it’ll be a bit more complex.

    If the symlink trick doesn’t work, you can try changing the docroot inside your virtual host configuration.  Some control panels don’t allow you to do that, so your mileage may vary.

    If you’re running the new and old sites as subdomains on the same server, you’ll probably have the DNS records all pointed to the same IP address.  You can make CNAMEs for old and new and point them to the www record, or make identical A records for all three.

    Hope that helps,
    Jack Scott

  • #8 / Feb 02, 2011 4:14am

    Embody_Bruce

    76 posts

    Thanks Jack. Will let you know how I get on.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases