Hi, as the title says i want to make clone from my wordpress website on the same droplet, but in different directory and database so i can test plugins and other coding stuff. Can you help me please? Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Yes, that would be possible.
Let’s assume following setup: You have WP in
/var/www/html
WP database is calledwordpress
User for that database iswordpressuser
identified bypassword
.First you need to copy
html
directory somewhere else. Let’s create folderclone
underwww
and copyhtml
there.Enter clone and verify you have
html
with files there.Make sure permissions are right, i.e.:
Verify WP permissions too.
If everything is there, we need to setup Apache to use it. I would setup a subdomain for it.
We will make subdomain
test
for it. Make CNAME record in DNS settingstest
@
.Now, we need Apache Virtual Host. This tutorial will help you. Basically, as you already have directory setup, just create second VHost and enable it.
You need to “clone” database. First create new database and give privileges to it. Login to MySQL:
Enter password when asked and press ENTER.
Create database:
And create new user or give privileges to existing one:
Update privileges:
Exit MySQL prompt:
Make a backup of current database:
This will create database dump in your home folder. Open it with any text editor:
And on top of it add:
Save it and exit editor. Run that file using:
For last step we need to update WordPress clone config. Open
wp-config.php
for clone:Make sure you set database name to
wordpressclone
and verify user used for it. Save it and exit. Go tohttp://test.example.com/wp-login.php
. Login, go to Settings -> General, update URLs, save and you are good to go.Good luck, I hope this will work for you, if you have any questions or problems, ask, we will try to help you :)
Just one question, how the variables for the PATH in the database changed ? I mean the path to the images and stuff, i really don’t get that. Please post some link so i can learn a little bit :)
Omg!!! Thanks man, you saved me a lot of headaches, for days i was trying to make this work. At first i tried www.example.com/testsite but i was having so much trouble with importing the database, tried duplicator but it was not working, and on my local PC it worked but that is another story :) . I was sceptical for using the USE wordpressclone; because i didn’t know what will happen, but i know that i learned so much from your help!!!
I know that your guide will ease so much headaches for other people too :))) Thanks again and have a nice day!!!