Viktor Fonster
Viktor Fonster

Reputation: 131

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?

Upvotes: 1

Views: 1875

Answers (2)

Eduardo Estevez Nunez
Eduardo Estevez Nunez

Reputation: 183

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.

Upvotes: 1

vitjbr
vitjbr

Reputation: 1166

Most probably your page URL setting in the database are set to live site.

Wordpress takes url settings from the database and if there is still live site url it will redirect you there, below you can see steps for changing URL.

  1. Login to your phpMyAdmin
  2. On left side find your database name
  3. Find wp_options table
  4. Change siteurl and home to your stage server URL

Upvotes: 1

Related Questions