Move WordPress site to a new server

Steps to move site to new server

Step 1: old server

  • MySQL: Export your old database in phpmyadmin
  • Zip File: login your old server via ssh to zip: (zip all files and folder in public_html by cmd: zip -r example.com.zip .

Noted: (.) means all files & folders even though (.htaccess or hidden)

Step 2: New server

  • Login to VestaCP and create DB Like the old server.
  • Go to phpmyadmin and import DB
  • Add your old domain into VestaCP (don’t tick HTTPS yet)
  • Login ssh and go to public_html
  • Please remove index.html & robots.txt (your previous server already has)
  • Download your file from old server by cmd: wget example.com/example.com.zip
  • Now extract that file by cmd: unzip example.com.zip

Step 3

  • Change your domain DNS (IP Address) in vultr or digitalocean
  • Back to VestaCP and edit your domain and tick (HTTPS)

Step 4: redirect HTTPS

  • Redirect by nginx located: conf/web/…….
  • Or using simple https

Bonus Tip: Redirect old domain urls to new one

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [NC,OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top