Search code examples
wordpressstaging

Siteground staging copy - All links sends to live site?


On my wordpress siteground staging copy all links including login page sends me to the live website. Wherever I click or try to login I get sent to the live website. Any idea what the issue could be?


Solution

  • Move wordpress websites, requires some steps.

    1 - Change siteurl field in the table wp_options to or the follow code on your config file:

    define('WP_SITEURL', 'http://www.new-domain.com');
    define('WP_HOME',    'http://www.new-domain.com');

    2 - Search and replace links from one site to another using SQL.

    SELECT wp_posts.post_content FROM `wp_posts` WHERE wp_posts.post_content like '%http://www.old-domain.com/%' 
    
    UPDATE wp_posts set post_content = REPLACE(post_content,'http://www.old-domain.com/','http://www.new-domain.com/')

    Moreover, the plugin WP Migrate DB is a good alternative. - https://wordpress.org/plugins/wp-migrate-db/

    Finally. You should never forget perform a full website backup ( Including files and the MYSQL DB ) before start with the process.

    Thanks. Regards, Ed.