Move WordPress site to a new server

Step: move site to new server

Step1: 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)

Step2: 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

Step3:
⁃ change your domain DNS (IP Address) in vultr or digitalocean
⁃ back to VestaCP and edit your domain and tick (HTTPS)

Step4: 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