Move a WordPress site in between domains in a Loopia account

This guide explains how to move a WordPress site between two domain names within the same Loopia account, for example from blog.example.com to example.com. The steps cover configuring the new domain in the Loopia Customer Zone, moving the files over FTP, adjusting WP Super Cache and updating the database with a search-and-replace script.

1. Configure the domain name

The domain name you want to move the WordPress site to must use the UNIX configuration for WordPress to work:

  1. Log in to your Loopia Customer Zone.
  2. Click the domain name you want to move the site to.
  3. Choose the configuration Website with LoopiaUNIX and click Save.

Configure a media subdomain

If your current site was installed via our One Click Installer, it most likely has a separate subdomain for media files (images, videos and so on), such as media.example.com. If you are moving WordPress between two different domain names (for example, oldsite.com to newsite.com), you must also configure a new media subdomain (for example, media.newsite.com). If WordPress is moving from a subdomain to a main domain or vice versa, you can skip this step.

  1. On the right side of the Customer Zone, click Add/Create…Sub domains.
  2. Select your new domain name in the list and enter media in the New sub domain field.
  3. Click Add.
  4. Click the subdomain and change the configuration to Autobahn, then click Save.

2. Move the files

  1. Log in to your FTP account.
  2. Rename the folder where the site is currently located to match the destination folder (for example, rename oldsite.com to newsite.com, and vice versa).
  3. If you have configured a new media subdomain (see above), also rename those folders (for example, media.oldsite.com and media.newsite.com).

If the source domain contains files that are not part of WordPress and that you do not want to move, simply renaming folders is not ideal. Instead, manually copy the WordPress content between the folders.

3. Configure WP Super Cache

If you installed WordPress via our One Click Installer, you may need to edit one file so that the WP Super Cache plugin (add-on) works properly after the move.

Open wp-content/wp-cache-config.php and find the $cache_path line. If you cannot find the file, you can skip this step.

The $cache_path line inside wp-cache-config.php

This path must be updated with your absolute cache path. If you do not know your account’s absolute cache path, contact us at support@loopia.se to obtain it.

In some cases you must also update wp-content/advanced-cache.php if an absolute path is specified there:

Absolute path inside advanced-cache.php

Note that this absolute path is different from the cache path above. If you do not know your account’s absolute path, contact us at support@loopia.se to get it.

4. Update domain references in the database

The last step is to replace the old domain name with the new one inside the database. If the domain name stays the same, you can skip this step.

This change can be made with a search-and-replace script you can download here. The download is a .ZIP file; extract it on your computer using any program that supports ZIP files, or right-click the file and select Extract All. The resulting folder (Search-Replace-DB-master) can then be uploaded to your FTP.

  1. Log in to your FTP account and place the folder under yourdomain.com/public_html. Then open the script in your browser; in this example, the URL will be http://example.com/Search-Replace-DB-master.
  2. Enter your old domain under replace and your new one under with.

Search-Replace-DB replace and with fields

  1. Click live run to apply the changes.

Live run button in Search-Replace-DB

  1. Finally, click delete me to remove the script. Leaving it on the server is a security risk.

Delete me button in Search-Replace-DB

Was this article helpful?

Related Articles