Christopher Schmitt

designer, web developer, author, strategist, dreamer

Working with the web since 1993, Christopher Schmitt directs Heatvision.com, Inc., a small new media publishing and design firm. The author of several books, including CSS Cookbook and Photoshop in 10 Simple Steps or Less, Schmitt is also a contributor to many web development magazines.

FROM THE ARCHIVE

WCATX: Moving Sites and Managing Domains

2 years ago

In his presentation at WordCamp Austin 2013, presenter Chris Weigman, Senior Developer at Springbox, talked about the steps required in moving domains and changing web hosts.


Why Move a Domain Name?

  • You’ve outgrown your shared or other host
  • You want a new host
  • You want a development site
  • You’re rebranding your site
  • You picked the “wrong” domain name

What are Domain Names?

  • Associating number, called an IP address, with short handle
  • A numerical name assigned to every device on the internet
  • Maps a human readable name to an IP address
  • Example: Facebook.com is the same as
    • 0:0:0:0:0:ffff:adfc:6e1b (IPv6 Expanded)
    • 10101101.11111100.01101110.00011011 (binary octets)
    • 2919001627 (decimal)
    • 173.252.110.27 (IP address)

Doman Names and WordPress

  • Your server your host on has an IP address
  • IP addresses are set in DNS
  • Many shared hosts have many sites on a server
    • This is why you can’t often to your site by just entering the IP address
    • You’re have to pay for a unique IP address to access it directly
  • DNS entries are cached–often for days
  • Tip: Don’t register your domain name with your web host If you get locked out of the web host, you will also get locked out of your domain name.

Changing Hosts

  • Services that provide easy migration:
  • What you will need for manual migration:
    • A good backup
    • Access to DNS
    • Direct access to database on both hosts
    • Access to wp-config.php and .htaccess files
    • New username and password
  • What you will want:
    • Navivat, a database management tool for transferring databases between servers
    • Forklift, very FTP software

Preparing for the Web Host Move

  • It’s easier to deactive on old host and reactivate on new host
  • One week out from the move:
    • Lower the TTL (Time To Live) setting on your domain to 1 minute
  • One day out from the move:
    • Make sure you have access to files and databases on both hosts, passwords, addresses, etc.

The Web Host Move

  • Create a fresh backup
  • Create a database on the new host
    • Write down database name, username, password
  • Use navigate to copy the old database to the new host
  • Use forklift or ftp app to cover over all the files
  • Edit wp-config.php
    • Update database name, db username, password
    • Update path info if preset (you’ll have to get this from your host)
  • Update .htaccess, if necessary
    • It’s easier to deactivate and then reactivate plugins
  • Change the DNS address (and it will take time to propagate through the Internet)
  • Test the site to see if it’s changed.
    • If something goes wrong, simply change back DNS and start over

After the Web Host Move

  • Increase TTL on your DNS to one day or more
  • Close old hosting account

Moving Web Hosts Tips

  • If you’ve outgrown your shared host don’t get another shared host
  • Warn your users that a move is happening
  • Test your backup
  • See if your host can migrate it for you. Most web hosts offer services to make this move for you.

What to Watch Out When Moving Web Hosts

  • Domain/host are on the same account
  • Plugin settings – some plugins will need their settings resaved

Changing Domain Names

  • A domain name is nothing but an alias to the IP address of your site
  • What you will need:
    • IP address of your host
    • Access to your site via FTP/SFTP
      • Note: cPanel or other host access will work as well
    • The username/password of your database
      • In WordPress, found in the wp-config.php file
    • Search and Replace DB
      • This small PHP script replaces every instance of old domain name to your new database with your new domain name.

Moving Domain Names

  • Step 1: Backup your database
  • Step 2: Point your new domain to your server
  • Make sure you update every record that you need to change
  • Step 3: Setup your domain with your host
    • How it’s done varies from host to host
    • Leave your old domain in place (for now)
  • Step 4: Verify your new domain has taken to your site.
    • It’s okay if the site itself is broken when you get there or redirects to the old domain)
  • Step 5: Update the database
    • Upload Search and Replace DB
    • Enter database details
    • Search for: [old domain]
    • Replace with: [new domain]
    • Delete Search and Replace DB so no one else can use it.
  • Step 6:
    • Update the .htaccess and wp-config.php
      • Replace any instances of the old domain name
  • Step 7: Clear cache on any caching plugins
  • Step 8: Test the site
  • Step 9: Update ogle Webmaster Tools, Google Anaytics, or any other services
  • Step 10: Wait a week to verify everything is working
  • Step 11: Deelte or redirect the old domain to the domain name with mod_rewrite in the .htaccess files:
    
    RewriteCond %{HTTP_HOST} ^old.domain.com [OR]
    RewriteCond %{HTTP_HOST} ^other-old.domain.com [NC]
    RewriteRule ^(.*)$ http://brand.new-domain.com/$1 [r=301,L]
    

Tips for Moving Domains

  • Keep domain name separate from you web host
  • Watch Google very closely
  • Don’t turn off the old domain, just redirect it.

What to Watch Out When Moving Domains

Create Dev Environment

  • Create a domain name for your computer or local IP
  • Copy Files and database to local computer
    • Changing domain name and host
  • Use GitHub/DeployHQ
    • Separate branch for production/dev/merge and deploy
  • Use host staging area (WPEngine and others) if not a developer

Putting It Together

  • Changing domain names really just require changing the database and .htaccess/wp-config.php to replace the old with the new.
  • Changing hosts requires only the changing of the server address and updating the wp-config.php on your host once database and files are directly copied over
  • A dev environment is just copying host and a new domain to your local machine.
  • The 2 biggest point of failure
    • Not making sure the new works before turning off the old.
    • System failure without a backup.

Leave Your Comment

JavaScript ELSEWHERE

Links of Interest

Internet Trails

Publications

Popular Blog Posts


Featured Publication

Designing Web & Mobile Graphics

by Christopher Schmitt

New Riders, 2013