How to Copy Your WordPress Site to a Subdomain for Safe Testing

How to Copy Your WordPress Site to a Subdomain for Safe Testing

Want to make a new website and replace a previous one? Or want to add new plugins to a WordPress website? The perfect way to get started is with the use of website staging. It provides you with a secure setting for experimenting and testing. In case, there’s any flaw, you don’t have to worry about the website crashing or getting out of service.

The exact technical steps to stage a website may differ from website to website. But here we simply share with you the simple steps to copy a WordPress website to a subdomain. Have a look:

Step 1: Form a Subdomain

WordPress Site to a Subdomain for Safe Testing

To begin with, you need a subdomain where you get to host your new staging websites. If you’re aware of a subdomain, you’d know that it’s easy and free to create. Plus, most of the hosting sites let you create various subdomains. Hence, stating a website becomes a good solution for you.

For making a subdomain, you have to go to the control panel and then go to Domain > Subdomains. In the given interface, you can enter a name that you’ve chosen for your subdomain. After that, click on create.

Step 2: Create & Download Your WordPress Website’s Copy

After you create a subdomain, you get ready to tackle a staging website. Furthermore, you have to build a staging model for your website for cloning the current website. This is very simple to do with the utilization of FTP. You need to create and set up an FTP client. We suggest you use FileZilla for this step, as it’s open-source and free of cost.

Create & Download Your WordPress Website’s Copy

When it’s installed, you want to link your FTP client to the FTP server. For doing so, you require the details of your FTP account. You can get these details from the internet hosting supplier at the time of enrollment into a new web hosting account.

The required fields are username, host, password, and port. Further, you’d notice two panes on the FTP client. On its left side are the folders, whereas on the right side of the computer are website files.

Copy these files and further save them to your computer in any folder.

It’s also possible to do the same in the control panel. For this, you have to go to Files > File Manager > Public_html. Next, on the interface’s top right corner, click on the settings. A popup will appear. Next, click on the Show hidden files.
Choose all the shown folders, except cgi-bin, and then click on copy on the top menu. Or do right-click on the selected files and further click copy. In the resulting popup, type the directory’s name. This will be your subdomain’s name.

Step 3: Export the WordPress Site’s Database

When you’re beginning to clone your WordPress website, you have to copy the database of a live website to its staging site. The database is present where all WordPress website’s data and content are stored. You further need to form a new database to stage a website before you start importing the content from your live website’s database.

Export the WordPress Site's Database

In the control panel, go to Databases > MySQL Databases. In the shown popup, type your new website’s name. Once it’s done, go to phpMyAdmin > databases. At this point, you’ll export your old database while importing the content to a new website in just a few simple steps.

On the left side of the panel, you can click on the old database. After that, click on export. Then, the file gets downloaded to a computer.

For uploading it to a new database, click on your new database and click import. Then, search and upload the database from a computer.

Export the WordPress Site's Database

After this step, next, you have to edit the credentials of the database in the wp-config.php file. In this file, you have to look for a line saying define( ‘DB_NAME’, …..). Just change your database name at this point.

The final step is to change the URLs in your new database. It will help you ensure that everything points to a new website – not an old one. You can do this with the help of a plugin. There are various plugins to get this task done. But it’s suggested to use the WP Migrate DB.

Step 4: Change URLs Using WP Migrate DB

To get started, you need to set up and activate the plugin out of the given WordPress plugin listing. After that, click on Instruments on the left side of the menu. Then, select Migrate DB.

Change URLs Using WP Migrate DB

Now, click on ‘migrate’ and scroll down to the area ‘Tools For This Site.’

Change URLs Using WP Migrate DB

Select ‘Custom Find & replace.’ It will further open up a dropdown menu that gives you the possibility to Find and Replace.

In the section for Find, you can enter the name of the old website with double forward slashes, as //oldwebsite.com. Now in the section of Replace, do the same URL for a new website.

That’s all. Now, you have a new fully-functional website for use.

Conclusion

It’s always a good decision to develop a staging WordPress website before creating a new website, new plugins, or any customization. We have shown you the four simple steps to do so manually. We have also mentioned certain plugins that are useful for coping a WordPress site with a subdomain.

Are you planning to make your own website? One good practice to follow is to develop it in a local development setting. Therefore, there won’t be any need to copy it subsequently.

Monika Thakur

Monika Thakur is a professional content creator for various blogs and websites, including Home Improvement, Technology, and more. With over seven years of experience in the digital world, she has dedicated her life to sharing her knowledge and experience about health, art, beauty, travel, technology, and lifestyle. She also loves interacting with readers and often encourages them to ask her questions related to her articles