How to duplicate a custom website at Hostinger

Creating a copy of a PHP/HTML website in Hostinger

Updated 1 day ago

This guide explains how to create a copy of a custom PHP or HTML website to use with a different domain name within Hostinger web, cloud or Agency plans, allowing you to keep the original site online. Duplicating a website can be useful to turn it into a template for a new project, or as staging environment for testing. You can create the copy on the same or a different hosting plan.

Before you start

This method applies specifically to custom-coded websites (PHP/HTML).

  • To duplicate a WordPress website on the same hosting plan, you can use the Copy website feature.
  • For Hostinger Website Builder sites, follow this guide: Duplicate Builder website.
  • Hostinger Horizons websites can be duplicated from the Websites → Options (⋮) in hPanel.

Step 1 – Download the source files and database

Locate the original website is located on hPanel and follow these steps:

  1. Create a backup of your website files and database.
  2. Download the file backup and the database backup to your computer.
  3. If using a CMS, identify the configuration file for your website (e.g., config.php) so you know where to update database details later.

Step 2 – Prepare the destination website

Access the Hostinger hosting plan where you want the duplicate website to reside.

  1. Add a new domain or subdomain to your hosting plan if you haven’t already. Alternatively, use a temporary domain.
    1. The domain must not be the same as the one used in the original website.
  2. Upload the file backup to the public_html folder of the new domain using the File Manager.
  3. Create a new database. Take note of the new database name, username, and password, as these will differ from the original.
  4. Import the database backup into the newly created database using phpMyAdmin.

Step 3 – Connect the files to the new database

To make the duplicated website functional, you must link the uploaded files to the new database:

  1. Open the File Manager for the new website and locate your configuration file.
  2. Edit the configuration file to replace the old database name, username, and password with the credentials of the new database created in Step 2.
  3. Save the changes.
  4. Test the website by visiting the new domain in your browser.

 

Your custom website is now duplicated and should be fully operational on the new domain. This copy is entirely independent; any changes you make here will not affect the original website.

NOTES

  • If you encounter an “Error establishing a database connection” double-check that the credentials in your configuration file exactly match your new database details.
  • Ensure the new domain is correctly pointed to Hostinger for the website to load.