Cloning a Drupal website

Posted under » Drupal on 8 June 2023

This is assuming you a cloning on the same drupal installation.

You can start by going to the drupal sites directory and rsync.

$ rsync --delete -azvv oldsite/ newsite

For www-data to be able to write to it, you will have to chgrp such that

$ chgrp -R www-data sites/newsite/

Clone your mysql database to a new one for the new website to use.

You will then edit and change the sites.php and settings.php file like so.

Make sure you put the new db settings on the settings.php.

Now create a new apache config and restart the server.

Check for errors. If it is a clone, it is unlikely to have any issues if you follow the steps above.

The logo and branding will look like the old site. To change, go to the admin site and /admin/config or configuration 'Basic sites settings'.

Clear the cache if you make db updates.

If you plan to clone the structure but put new contents, clear or truncate the following tables. Although there are more if you create more types. You can tell if its a custom type by the double underscore eg. 'node__field_key' and 'node_revision__field_key' which is different from Drupal's 'key_value'

node
node_field_data
node_field_revision
node_revision
node__body
node__field_difficulty

And their corresponding revision tables

node_revision__body
node_revision__field_difficulty

You can also clear the taxonomy and user tables if the websites are different.

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data