问题
I have a wordpress site and I have to do modifications very often so i would like to create clone of that website for testing because i would like to test my modification first for a few days before i put them on my site.
There are links to the "real" site everywhere so i'm not sure how to do that.
UPDATE (improved explanation):
Problems:
links are absolute
this need to be online so other developers can test site
回答1:
Copy/paste your entire files from your domain to everywhere you want as first step.
Go to the phpMyAdmin or use a tool that permit to you to export your database as .sql
.
Open the .sql file and run a find and replace and replace all your absolute path (just the one before wordpress: ie.: of this http://www.yoursite.com/wp-content/etc. Replace only http://www.yoursite.com)
Check for the permission of the DB, maybe you should change also the Server name, DB Name, Username and Password.
Create a new database and import the file you exported and modified the minute before.
Now you got a clone of the previous website ready for your experiments on both side, files and DB.
回答2:
2nd result in Google for me...
http://wpmu.org/quickly-clone-and-migrate-wordpress-sites-with-the-duplicator-plugin/
回答3:
If you're going to use a different hostname or path for the copy of the web site, it's not as simple as copying your files and exporting / importing your MySQL database. There are, in fact, embedded absolute URLs in various columns of the database.
There's a step by step procedure here.
http://codex.wordpress.org/Moving_WordPress
回答4:
If you were working on WP MultiSite you could avoid having to duplicate your database and then doing a sql find and replace as mentioned by using one of the WP cloning plugins.
The NS Cloner - http://wpmu.org/clone-sites-within-a-wordpress-multisite-network/handles everything for you automatically including the DNS, DB, and Hosting. Based on your mutlisite setup you can then deploy it to a new subfolder or subdomain. For advanced features after your new site is live you can use the Pro Version and do advanced things like search and replace on the live site.
Again this is for MultiSite only, however I would highly recommend moving to that architecture anyway to allow you to take advantage of all of WP multisite has to offer.
回答5:
WP Staging allows you to clone an entire site including database and files into a subdirectory of your main site for testing purposes with just two clicks: https://wordpress.org/plugins/wp-staging/
回答6:
What's your problem exactly? You just need to download all worpress files from your server. Then create a local copy of the database so that you have all the data.
All the links are relative in wordpress, so you won't have any troubles with links to the "real site" ;)
来源:https://stackoverflow.com/questions/13705127/how-to-clone-wordpress-site-for-the-develope-purpose