1 – Migration Guide

  1. restore database and files.
  2. change php.ini (increase upload_max_filesize and post_max_size values if needed).
  3. change wp-config.php (database name, userid, and password).
  4. change domain name entries in SQL table wp-options (siteurl and home entries).
  5. Install and activate the Better Search Replace plugin if not yet done so.
  6. run the Better Search Replace plugin (dashboard->Tools)
    • Choose tables wp-posts and wp-postmeta.
    • replace ‘https://testsite.songchanhniem.com‘ with ‘http://localhost/scn-test
    • replace ‘http://testsite.songchanhniem.com‘ with ‘http://localhost/scn-test
  7. run Elementor’s URL Replace tool (elementor->tools->URL Replace
    • replace ‘https://testsite.songchanhniem.com‘ with ‘http://localhost/scn-test
    • replace ‘http://testsite.songchanhniem.com‘ with ‘http://localhost/scn-test
  8. Deactivate the Better Replace Search plugin once migration is completed.

NOTE: Do not need to run Regenerate CSS because running it seems to make Elementor’s global custom colors disappeared.

Clone MySQL Database

  1. From phpmyadmin, make sure that the destination database is empty.
  2. Export source source database (let’s call it mybackup.sql).
  3. from cPanel, upload mybackup.sql to any folder (ie /tmp).
  4. from cPanel, open Terminal, change to /tmp folder.
  5. execute: mysql -u db-username -p database-name <mybackup.sql
    provide password when prompted.
  6. Go to phpmyadmin and verify the newly imported content.

Setup WP site in a subfolder

WP site = songchanhniem.com
subfolder = /scnprod

  • Domain songchanhniem.com still points to root public_html.
  • Add the following code to /public_html/.htaccess file:
    • # Minh – redirect WordPress main site to subdirectory /scnprod
      # BEGIN WordPress
      <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteCond %{HTTP_HOST} ^(www.)?songchanhniem.com$
      RewriteCond %{REQUEST_URI} !^/scnprod/
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ /scnprod/$1
      RewriteCond %{HTTP_HOST} ^(www.)?songchanhniem.com$
      RewriteRule ^(/)?$ scnprod/index.php [L]
      </IfModule>
      # END WordPress
  • This is the content of the .htaccess in the subfolder /public_html/scnprod/.htaccess:
    • <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
      RewriteBase /
      RewriteRule ^index\.php$ – [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      </IfModule>
Scroll to Top
Scroll to Top