Change wordpress domain name with ssh terminal without phpmyadmin

1. use ssh terminal login your server, like ‘ssh [email protected]_ip_adress’.

2. $ cd /your_wp_root_path

3. $ vim wp-config.php

add:

define(‘WP_HOME’,’http://example.com’);
define(‘WP_SITEURL’,’http://example.com’);

3. $ mysql -uroot -p //enter your mysql password

4. $ use your_wp_sql;

6. $ UPDATE wp_options SET option_value = replace(option_value, ‘example.net’, ‘examplei.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

7. $ UPDATE wp_posts SET guid = replace(guid, ‘example.net’, ‘example.com’);

8. $ UPDATE wp_posts SET post_content = replace(post_content, ‘example.net’, ‘example.com’);

9. $ UPDATE wp_postmeta SET meta_value = replace(meta_value, ‘example.net’, ‘example.com’);

10. $ vim wp_config.php

remove:

define(‘WP_HOME’,’http://example.com’);
define(‘WP_SITEURL’,’http://example.com’);

Leave A Comment

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