Moving the installation of LiveAgent to another domain or directory

Important notice: LiveAgent can be moved to another domain or directory just 2 times !
If you reach this limit,  your license will be invalidated.

How to move the installation of LiveAgent:
1. You can move all the files to the new location (or rename the directory where LiveAgent is installed).
2. If your database server doesn't change, you don't need to change anything in concerning the database.
If the  database server changes with the domain too (e.g. moving installation to another server), you will need to dump the database of LiveAgent and import it into the new database on the new server.
Then, in accounts/settings.php of the installation of LiveAgent in the new location you will need to change the database connection information the new database server.

Keep in mind that since version 5.16, if the new database uses a different password than the previous database, you need to save the previous password in new setting ENCRYPTION_KEY for reasons explained here.
Inside the database at the new server (location) in the qu_g_settings database table you will need to update the value of the following rows:
"serverName"   = new domain of LA
"baseServerUrl" = new directory of LA
Note: You should change URL of uploaded images/logos. The best approach might be searching for the old domain name in the database directly and replace it in the all tables where it makes sense like qu_g_settings, qu_la_contactwidget_attributes or you can simply reupload the images for buttons and logos from inside of the admin panel when you notice that some are missing.
NEVER replace OLD_DOMAIN_PATH in tables: qu_la_messages and qu_la_message_groups
It should be enough to run the following SQL queries in the database of your installation of LiveAgent to change at least the most obvious images:
For the 'qu_la_contactwidget_attributes' table:
UPDATE `qu_la_contactwidget_attributes`
SET `value`= REPLACE(`value`, 'OLD_DOMAIN_PATH', '');
For the 'qu_la_contactwidgets' table:
UPDATE `qu_la_contactwidgets`
SET `onlinecode`= REPLACE(`onlinecode`, 'OLD_DOMAIN_PATH', '');
UPDATE `qu_la_contactwidgets`
SET `onlinecode_ieold`= REPLACE(`onlinecode_ieold`, 'OLD_DOMAIN_PATH', '');
For the 'qu_la_contacts' table:
UPDATE `qu_la_contacts`
SET `avatar_url`= REPLACE(`avatar_url`, 'OLD_DOMAIN_PATH', '');

For  the  'qu_g_settings'  table:UPDATE `qu_g_settings`

SET `value`= REPLACE(`value`, 'OLD_DOMAIN_PATH', '');

As you can see on the examples above the syntax is pretty self explanatory and you can run similar queries on other tables in which you will find OLD_DOMAIN_PATH, for example if you added this URL to your email templates or to canned messages you might want to change it also there either manually from panel or by running similar SQL queries on tables where you find OLD_DOMAIN_PATH

On the other hand you will find OLD_DOMAIN_PATH also in some tables in which it doesn't really matter anymore like for example in qu_la_conversations, qu_la_message_groups, qu_la_messages and such. In these tables there is no point in changing the URL and moreover it can cause a lot of troubles if changed.

After this change you will need to validate your license with the new domain. So try to reach the new location of your LiveAgent and when you get an 'Invalid license' screen  use your license in the 'License id' field and press the 'Update license' button. 

3. Now, when all is working again, you have to realize that your domain, or at least directory changed, so you have to replace the contact us buttons (chat buttons, forms) in your pages with the freshly regenerated ones that you may obtain in the agent panel.