Changing Domains and Migrating Sites with WP Rocket

In this article:

When you change the domain for your site, or you move a site from a development URL to a live URL, there are a number of things to take care of. Here are the ones related to WP Rocket. 

Deactivate and reactivate WP Rocket

Deactivate and reactivate WP Rocket in its new location, so that the configuration file can be updated correctly.

This should be all that is required. If you still have problems, you should manually check the following: 


There should only be 1 php file here (except for multilanguages sites), named with your site’s domain(s), for example: 

If you see another file with the domain name of the old site, of a development site, just delete it. Be careful to also have the right www or non-www before the domain name.


When you re-activate WP Rocket, the plugin should automatically create or update this file, but you can double-check it to make sure it has the correct paths in it. 

If think it might be incorrect, or if you're not sure, you can delete the file. Then de-activate and re-activate WP Rocket, so the file will be regenerated.


There should be a folder named with your site's domain here. For example:

If you've duplicated the website from your development site, you might have a folder named like your dev site, or the previous domain your site used. You can delete that old folder. 

If you are moving your site from one location to another, you should exclude the content of the /wp-content/cache/ folder from the migration process.

Using Export / Import Settings tools and a fresh copy of WP Rocket

An alternate method is to reinstall WP Rocket:
  1. On Site A, go to Settings > WP Rocket > Tools
  2. Export your current WP Rocket settings
  3. Download your new WP Rocket zip file from
  4. Install and activate the new WP Rocket zip file on Site B
  5. Import Site A settings on the Tools tab of Site B

Make sure your site is already using WP Rocket version 3.x in order to use the settings export/import. Older versions used a different export file format, which is not compatible with the newer versions.

More details on Export / Import Settings here: Tools Tab: Export/ Import Settings and Version Rollback

Pushing changes from Staging to Production

From WP Rocket 3.6, WP Rocket will automatically regenerate the advanced-cache.php file when the plugin detects that the paths inside it are no longer correct.

For  WP Rocket versions < 3.6, if you are pushing changes from staging server to production, you could have issues with WP Rocket.

The reason is that WP Rocket is adding server-specific paths in the advanced-cache.php file. When you push that file to another server, where the paths are different, WP Rocket won't work. Deactivating/reactivating WP Rocket fixes the issue because the advanced-cache.php is recreated. 

The solution here is to not push the advanced-cache.php file by adding it to .gitignore

That way, each server will have their own version of the file with the correct paths.

WP CLI user?
You can use our WP Rocket CLI to re-generate the necessary files. Please see:, and specifically the wp rocket regenerate command.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.