Moving a Contao theme to another server
This guide describes what to do if you want to move your theme to another server.
1. Backups
1.1 Back up the database
First back up the database. You can simply export the database with phpMyAdmin (available in your hosting account).
1.2 Back up the files
Back up the following folders:
- /files
- /templates
Back up the following files:
- composer.json
- composer.lock
- system/config/localconfig.php
- config.yml (in /config or /app/config)
- parameters.yml (in /config or /app/config)
- web/.htaccess (if customized)
If you have made other customizations, you may also need to back up the folder /contao or /src. If you still use old Contao 3 extensions, you may also need to back up folders in /system/modules. (You can ignore symlinks here.)
2. Install Contao and restore the backups
2.1 Restore the database backup
Create a new database and import the SQL file of the backed-up database.
2.2 Adjust parameters.yml
Edit the backed-up parameters.yml with an editor and replace the access data of the old database with that of the new database. All other parameters stay as they are.
parameters:
database_host: localhost
database_port: 3306
database_user: DATENBANK_USER
database_password: DATENBANK_PASSWORT
database_name: DATENBANK_NAME2.3 Install Contao
Now install Contao as usual with the file contao-manager.phar.php in the web folder.
Important: do not update the database yet after the installation!
2.4 Restore all other backups
Now copy all backed-up files back to the right places. It is important that all files are copied back to the correct location, i.e. not into the web folder, but one level above it.
From Contao version 4.8, parameters.yml and config.yml go into the folder /config; for versions lower than 4.8, the files must be in the folder app/config.
2.5 Install the extensions
Once you have copied composer.json and composer.lock back to the right place and opened the Contao Manager, new packages should be shown under the menu item Packages. Click the button Apply changes in the footer to install all extensions.
2.6 Update the database
Once all extensions have been installed, open the install tool and update the database.
2.7 Open and check the website
Now open the website and check that everything works.
If problems remain, you can recreate the symlinks under system maintenance in the back end and clear the script and image cache. This is not strictly necessary, though.

