Cara Merubah dan Update URL Wordpress di Databases Ketika Pindah ke Server Baru

Oke mulai dari mana kita...
emmmm
langsung aja saya emg gak pinter merangkai kata karena saya bukan Punjangganya Kenjen Band. :))

OK...
Ketika kita selesai upload website Wordpress kita dari localhost ke Hosting misalkan atau pindah ke hosting lain pasti kita perlu merubah konfigurasi di dalam wordpress kita  agar website bisa terhubung ke databases,

Kita anggap proses upload file direktori website dan database sudah sukses terupload ke Hosting Wordress baru kita.
Jika belum tau cara uploadnya coba liat google. :))

setelah itu pastikan kita memilih database yang benar, kemudia klik pada tab SQL lalu copy dan pasti perinta berikut

UPDATE wp_options SET option_value = replace(option_value, 'http://UrlLama.com', 'https://URLBaru.id') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET post_content = replace(post_content, 'http://UrlLama.com', 'https://URLBaru.id');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://UrlLama.com','https://URLBaru.id');

UPDATE wp_usermeta SET meta_value = replace(meta_value, 'http://UrlLama.com','https://URLBaru.id');

UPDATE wp_links SET link_url = replace(link_url, 'http://UrlLama.com','https://URLBaru.id');

UPDATE wp_comments SET comment_content = replace(comment_content , 'http://UrlLama.com','https://URLBaru.id');

UPDATE wp_posts SET post_content = replace(post_content, 'http://UrlLama.com', 'https://URLBaru.id');

UPDATE wp_links SET link_image = replace(link_image, 'http://UrlLama.com','https://URLBaru.id');

UPDATE wp_posts SET guid = replace(guid, 'http://UrlLama.com','https://URLBaru.id');
Ganti alamat url yang berwarna merah dengan alamat kalian sendiri lalu klik tombol "go". Nah sepeerti ini tampilannya


atau bisa juga via comand line kalo ada yg akses lewat ssh atau sejenisnya jadi seperti ini
username@[~/Desktop]: mysql -u root -p databasename
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 892
Server version: 5.5.13 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0

mysql> UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
Query OK, 0 rows affected (0.02 sec)
Rows matched: 964 Changed: 0 Warnings: 0

mysql> UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
Query OK, 0 rows affected (0.05 sec)
Rows matched: 964 Changed: 0 Warnings: 0

mysql> UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');g
Query OK, 0 rows affected (0.01 sec)
Rows matched: 686 Changed: 0 Warnings: 0
Kalo sudah OKE semua tinggal update dah file wp-config.php
define('DB_NAME', 'databasename');

/** MySQL database username */
define('DB_USER', 'username');

/** MySQL database password */
define('DB_PASSWORD', 'password');

/** MySQL hostname */
define('DB_HOST', 'localhost');
Okee Selesaii.. Selamat website Wordpress kita berhasih pindah ke server baru atau bahasa kerennya berhasil migrasi website wordpress.. hoooreee :))


Sumber : https://blog.templatetoaster.com/update-old-urls-in-database/


Selanjutnya
« Tulisan Sebelumnya
Sebelumnya
Selanjutnya »