当前位置: 动力学知识库 > 问答 > 编程问答 >

php - What is best practice to config when changing host in wordpress?

问题描述:

I develop my Wordpress site from the localhost, name: http://moingaytoisong.dev

My real website is : http://moingaytoisong.com

Every time I pull the database from the live site to my local site, I need to search and change the url in wp_options table. It's quite frustrate.

Do you have any better idea?

网友答案:

In your wp-config.php, just need to add these lines below:

define('WP_HOME','http://moingaytoisong.dev');
define('WP_SITEURL','http://moingaytoisong.dev');

It will overwrite the url in database, so no need to change the url in wp_options anymore. Your local website and your live website can use the same database without any issue

网友答案:

I think you should check some plugins. You can use wp-migrate-db to migrate your database according to your host. You can use Duplicator plugin to shift your site from one host to another in a few simple clicks.

For Duplicator check this https://www.youtube.com/watch?v=tdP3quWLM0Q

分享给朋友:
您可能感兴趣的文章:
随机阅读: