IT/Procedures/Website Copying

From msgwiki
< IT‎ | Procedures
Jump to navigation Jump to search

Copying or moving a Website to a different domain takes several steps which are listed here.

These steps assume that everything is done on one machine. If the website should be copied/moved to a different domain and a different machine, combine the steps here with those in Website Moving

Westhost and Zoneedit

First of all one has to create the domain the website is going to be on and change the settings the way they should be.

Files

Create a new folder for the files of the "new" website, and copy all the files from the old website there. Make sure the ownership and permissions are correct. The easiest way to do it is as follows:

sudo mkdir FOLDERNAME

sudo cp /var/www/html/OLDFOLDERNAME /var/www/html/NEWFOLDERNAME

Database

To copy the database open Phpmyadmin and follow the following steps:

  1. select the database of the "old" website
  2. then select the "Operations" tab
  3. go to "Copy database to:"
  4. enter the new name
  5. select "structure and data"
  6. Check "CREATE DATABASE before copying" and "Add AUTO_INCREMENT value."
  7. Click "Go"

After this (when using Wordpress, other programs probably have something like that too), go into the new Database and open "wp-options" and change all the name and url of the old website to the name and url of the new one.

source: https://my.justhost.com/cgi/help/how-to-copy-a-database-using-phpmyadmin

Vhost files

see for more details: Website Moving

In "wordpress.conf" copy the section of the old website and change all the references from the old to the new website.

In "wordpressSSL.conf" copy the section of the old website and change all the references from the old to the new website. Then delete the SSL certificate part in order to install a new one. To do so use:

sudo service apache2 restart

sudo apache2ctl configtest

sudo certbot

This should show a list of all the websites on the machine and ask for which one a certificate should be made. Select the new website and proceed. After that check whether a certificate was added to "wordpressSSL.conf".