Transferring a wordpress site to a new domain
To transfer the site, you need to take a few simple steps.
- Make a backup copy of all files and database.
- After copying, log into the admin panel on the old site in Transliteration settings, replace the old address with the new one. Both options.
WordPress Address (URL)
Site Address (URL) - For fidelity, you can in the file wp-config.php, located at the root of the site, add a couple of lines with the addresses of the new domain:
12define('WP_HOME', 'https://prografika.com.ua');define('WP_SITEURL', 'https://prografika.com.ua'); - The next time you migrate, it will be enough just to replace these two parameters.
For further transfer, download all files via FTP and upload to a new server. In the same file wp-config.php change database parameters, old to new.
1 2 3 4 |
define('DB_NAME', 'имя базы данных'); define('DB_USER', 'пользователь'); define('DB_PASSWORD', 'пароль'); define('DB_HOST', 'хост'); |
Using MyAdmin, we transfer the database to a new site. In the same MyAdmin we execute requests:
1 2 3 4 |
UPDATE wp_options SET option_value = REPLACE(option_value, 'https://OLD-SITE.com.ua', 'https://NEW.com') WHERE option_value NOT LIKE '%{%'; UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'https://OLD-SITE.com.ua', 'https://NEW.com') WHERE meta_value NOT LIKE '%{%'; UPDATE wp_posts SET guid = REPLACE(guid,'https://OLD-SITE.com.ua', 'https://NEW.com'); UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, '/home/OLDSITE.com.ua/subdomain/', '/var/www/vhosts/NEW.com/http/') WHERE meta_value NOT LIKE '%{%'; |
Pay close attention to website addresses when making requests.
If done right, then the site transfer should be successful. At least for the current date it works.
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.