When administering a Drupal site, its a good idea to make a duplicate site for testing purposes. This allows the administrator to make large changes to the web site while the existing site is still running. This article will teach how to make a duplicate Drupal site for testing.

Steps to make a duplicate Drupal site on a subdomain

First step is to create the subdomain

To set up a Drupal test site, create a subdomain that you will use to separate your Drupal site. The following are the steps on how to set up the subdomain.

  1. Log into your cPanel
  2. Create the subdomain that will be used for the Drupal testing site. For example:

    testsite.yourdomain.com

Second, set up the Database

Because Drupal stores all the content in a database, the database will need to be imported into a separate database. The following section will explain how to export your Drupal database, change the site url in the database, and import the database into your testing database.

  1. Create drupal databaseCreate a database.
  2. Create Drupal database userCreate a database user.
  3. Assigne permissions to Drupal database userAdd the user to the database will full permissions.

    Important! Make sure you save the Database name, Username, and password in a notepad or text document. These will need to be used later in the setup.


  4. Export the old Drupal DatabaseIn PhpMyAdmin, Export your current database
  5. Make a duplicate of your Database on your local computer. (This is to prevent you from having to export the database again due to any possible mistake.)
  6. Find and replace old domain with newOpen the .sql file with Notepad++ or another editor.
  7. All occurances replacedFind and replace all instances of the old subdomain with the new subdomain. For Example, if your existing Drupal is on:

    drupal.yourwebsite.org

    Replace all instances of the old domain with the new domain. For example:

    drupaltest.yourwebsite.org

  8. Import the Drupal database to the new databaseImport your Database into the new database you created.

Finally, move the Drupal files

Now that the database is set up, the files will need to be moved and the settings.php file will need to be edited to use the new database connection. The following section will explain how to move and set the settings.php file to work on the new subdomain.

  1. Go to your File Manager.
  2. Copy your Drupal Files from your current directory to the document root directory created for your subdomain. The root directory usually is the same name as the subdomain that was created.
  3. Select all the Drupal files.

    Important! When selecting all your Drupal Files, make sure any other files and/or folders not related to Drupal are not selected. After selecting all, hold the Ctrl key and click the folders to deselect any "non-Drupal" files and /or folders. If you do not deselect unrelated files and/or folders, there will be duplicates taking up disk space.


  4. Click Copy at the top right side of the File Manager.

    Type the path to the folder you want to move your files to. (This will be the subdomain document root location) Click Copy.


  5. Now we will need to update the database settings for Drupal. Navigate to the path to the Document Root folder for the Sub Domain. For example:

    /home/userna5/public_html/testdrupal/sites/default/settings.php

  6. Select the file and click the code editor.

  7. Update the Drupal settigns.phpUpdate the database name, database user and the database password to the test database you made.

    Save the changes.

Like this Article?

Login to comment.

Your Opinion Matters

... but we need to know what you're thinking!

I'm James Richardson, your friendly Community Support technician, and I wrote the article you're looking at now. I like to think it's perfect, but I'm sure you have some suggestions. Please, let me know what they are!

Feedback
Your Email Address
Because we'd like to talk with you!

Latest Questions

If you need some help, submit your question to our Community!
We guarantee a response within 60 minutes (8am - 9pm EST, Monday - Friday)
Ask a Question!
Recent Questions
  1. zone shipping
  2. How do I stop Outlook clients from getting this warning?
  3. how to make editable order in admin in opencart?

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!