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

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

The exact steps to follow to create a staging website will differ based on the kind of website. In this article, we will show you how to transfer your WordPress website into a subdomain for secure staging. These are the steps you need to follow:

Step 1: Create a Subdomain

It is necessary to have an additional subdomain to host your new staging sites. Most likely, you are already aware of the definition of a “subdomain.” Subdomains are completely free to establish, and the majority of hosting companies permit the creation of multiple subdomains. This is why creating your staging website on the subdomain is an ideal solution.

To create a new subdomain, go to cPanel and click Subdomains and then Subdomains.

In the new interface in the resulting interface, type in the name you’ve chosen to create your subdomain. Click to create.

Step 2: Create and Download a Copy of Your Website

After you have set up a subdomain, you now have a URL for your staging site. The next step to create the staging version of your site is to copy and paste your current website. This is simple to accomplish by using FTP. You’ll have to install and download an FTP client. We’ll suggest using FileZilla to achieve this, as it’s completely open source and free of charge.

After installation, you’ll have to connect the FTP client to your FTP server. In order to accomplish this, you’ll require your FTP account information. These are usually supplied by your hosting service when you sign up for the first time for a new web hosting account.

The required fields include the host, username, password, as well as port. You’ll see two panes within the FTP client. On the left side will be the folders that are on your computer, and the right side will be the website’s files.

Save these files by copying them and saving them to a file on your system.

You can accomplish this via cPanel. Navigate to Files > File Manager >Public_html. In the upper right corner of the screen, click the settings. In the subsequent pop-up, select to show hidden files.

Select all folders that show except for the cgi-bin. Click the button Opy from the menu at the top or right-click on the files you want to copy and choose the option to copy. In the pop-up that appears, you will need to enter the full name of the folder. This is the name you select as your subdomain.

Step 3: Export the Database

The next step to clone your WordPress website will be to copy the database from your live website onto the staging site. It is the database where the information and content of the WordPress website are stored. You’ll need to set up an entirely new website database to host your stage site prior to importing your content from your database on the website you are running.

In cPanel, go to the Databases tab and then MySQL databases. In the resulting interface, type in the name of your new site. It could be anything, like a “test”.

After that, go to the phpMyAdmin database section. Here, you will export your old database and then import the data into the new database in only a few easy steps.

In the left-hand pane In the left-hand panel, click on the previous database and then export it. The file will be transferred onto your PC.

To upload it into the new database, select the latest database and then upload it. Find and download the database on your computer.

After this has been completed, the next step will be to modify the database credentials within the wp-config.php file.

Within the wp-config.php file, look for the section that reads define( “DB_NAME”), …..);. Change the database’s name to the one you want in this section. Once you’ve done this, you’re nearly done.

The last step is to modify the URLs of the new database so that they all link to the new website, not the old one.

This can be done by using the help of a plugin. There are many plugins that you could use to complete the task. We’ll suggest the WP Migration DB.

Step 4: Change URLs With WP Migrate DB

To begin, start by installing and activating the plugin within the WordPress plugin directory. Once you have done this, click Tools from the menu left of the screen and then select to migrate DB.

Select the Migrate button and then scroll to the section labeled Tools for This Site.

Select Custom Find & Replace. This will open a dropdown that offers a choice to Find and a third option for replace.

In the area in the box for Find in the Find field, type in the URL of your previous website followed by two forward slashes such as the following: // In the area of Replace, Do the same thing with the URL of your new website.

That’s it! You must have a functioning staging website you can work with.

Two More Ways to Clone Your Website to a Subdomain for Staging

There is no need to employ the manual method for cloning your site to a subdomain that can be used for staging. In reality, there are various ways to set up a staging site. One of the most straightforward ways to do this is by using custom options offered by your hosting provider or by using the plugin.

Here’s a quick overview of both options:

Alternative 1: Creating a Staging Website in cPanel

If your hosting provider utilizes cPanel, you are able to make a staging site with only a couple of clicks. To begin, create a subdomain using the steps in step 1 above.

After that, Once you’ve done that, head from the Software tab and select WordPress Management from Softaculous.

Choose the dropdown option beside the name of your site, Then click on the staging. Enter the subdomain that you created.

Leave a Reply