Sometimes we have to move the website from one server to another or create a local development environment. In this article I will show you how to do it and which seems a best a good practice to do so.
Basically, the system consists of the CMS files and a database, usually a MySQL database. For backup and restore you need both a database dump and a backup of the filesystem, also the configuration must be changed to the new database system.
Moving the Contao files
First copy all CMS files from the system to the local filesystem, note that also the .htaccess file is being transferred.
To backup the MySQL database, there are several ways and can be created with any SQL client or by a script. The Linux script for automatic backup I posted here some time ago. Also, any SQL client for backing up and restoring are used in this case I explain this using the MySQL client PhpMyAdmin.
Before the backup, you should perform system maintenance to reduce the amount of data when exporting, this unneeded records are removed from the database. For this purpose, we log in to the backend system and select the menu item “System Maintenance” from the “System” section:
This action also deletes the search index which will be rebuilt manually or while opening the pages from the website.
Next, the database must be backup up using some backup options.
After the successful export of this database will be imported on the target system again. This is similar to the mi export any SQL client.
Finally the configuration to the database needs to be adjusted, this works either by calling the Contao installation tools or by manual adjustment of the configuration file in system / config / localconfig.php. After the change, the page should now be working as desired, and in any case should be carefully checked that everything works fine.