开发者

Creating a duplicate WordPress install for testing

I am trying to create an identical wordpress website - on the same server. I need to create this as a testing environment but every time I try to duplicate the site it breaks. Is there an easy way to create a testing environment, of the live site, on the same server while keeping all of the same widge开发者_JAVA百科ts, plugins and content?

I am an experienced web developer but a novice when it comes to Word Press.

I appreciate the help.


In my experience the following usually works:

  1. Setup your prod site
  2. Copy all files to the test site
  3. Modify the wp-config settings as needed, and create the test db schema
  4. Export all the data from the prod site control panel and import into the test site


The problem is that while you have all the files identically, your database contains all the configuration information for the live site. You'll need to copy the database from live to your development/testing server. You can run an export on the SQL and import the data into a new database. Then modify the wordpress/wp-config.php file in your development site to connect to the new copied database.

Additionally, you'll want to go through the new copied database, table: wp_options and change the site URL to match the development site/server instead of the live server. Some default fields you'll want to change are: option_name: home option_name: siteurl As well as fields installed by plugins that contain your site URL and path.


  1. Create a directory for the testing.
  2. Backup the original database, and create another one (you may use the same db user/pass if you like).
  3. Execute the SQL file from the backup (at the test database)
  4. Edit the wp-config.php.
  5. (Test Database) Update the URL at the (your prefix)_options table. It's the very first value with the option name: siteurl
  6. Done.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜