How to move your Drupal site from old domain to new one

This tutorials outlines common steps I usually take when changing from old domain to new domain. I assume you want to move from www.olddomain.com to www.newdomain.com

  1. Add the domain and any subdomains (for example "m.") in the Cpanel. Then create the email id for this domain. No need to change the mysql part.
  2. Move all domain files( including GWT/BWT verification files) from old domain directory to new one
  3. Setup this .htaccess in the old domain:
    RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{HTTP_HOST} !^m\.
    RewriteRule ^ http://www.newdomain.com%{REQUEST_URI} [L,R=301,NE]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{HTTP_HOST} ^m\.
    RewriteRule ^ http://m.newdomain.com%{REQUEST_URI} [L,R=301,NE]
    
    

    Remove all files except for .htaccess and GWT/BWT verification files.

  4. In the old domain copy the Google's and Bing webmaster verification files.
  5. In GWT add both domains : http://www.newdomain.com and http://newdomain.com. Setup redirect from http://newdomain.com to http://www.newdomain.com as in default Drupal .htaccess by uncommenting the lines. Verify them all.
  6. Go to admin/config/search/xmlsitemap/settings and check/change the Default Base URL in "Advanced Settings". In the main site sitemap see that links are correct and check it by clicking them.
  7. Go to admin/config/system/site-information and change your email id
  8. Issue site change request in GWT and BWT. Unlike Google's, you can't cancel the "Change of Address" in Bing.
  9. Submit sitemap for the new domain for both BWT & GWT.
  10. Check your mobile site settings. Create the "m." subdomain for new domain
  11. Search in your hosting account folder all occurrences of old domain(command: egrep -rl "www.olddomain.com") and change it to new one. Do the same in your development system too in all the files.
  12. Update the site in social networks like Facebook, Twitter and site uptime monitoring tools