How to use WP Rocket in a Multisite environment
In this Article
If you want to use WP Rocket on a multisite environment, there are a few details you should consider at the moment of purchasing your licence and activating the plugin.
License for Multisite environment
If you set up multiple sites within a Multisite network, one of the following patterns would apply:
- example.com, example.com/subsite-1, example.com/subsite-2… etc.
- example.com, subsite-1.example.com, subsite-2.example.com… etc.
Thus, you will be using one and the same top level domain across your network.
In this case (again, as above) you may use one and the same license key for all the sub-sites in your network.
Exception: Top Level Domains for Sub-Sites
If, on the contrary, you use top level domains for your sub-sites, you will have to use multiple separate license keys—one for each of your your sub-sites.
Although Site URLs for those sub-sites would technically share the same top level (network) domain, in operation they could, in fact, provide content totally unrelated to each other, and not even their domain would indicate they were part of a Multisite network. That’s why in this particular case, they can not share one single license key.
Activate WP Rocket on a Multisite
WP Rocket can not be network-activated in a WordPress Multisite installation. Instead it will have to be activated on each sub-site.
At the moment, we chose to make WP Rocket work in this way for technical reasons: if a plugin is network activated, all its options will be automatically applied to every sub-site in the network.
But, as an example, if one sub-site in the network has a problem with minification, and the only solution would be disabling this option, all the other sub-sites will be affected by this choice, and they couldn't use minification anymore.
If you use a domain mapping plugin on your multisite, when activating WP Rocket, you must access your wp-admin area using the mapped domain, that is, the domain that will be used on the front-end of the site. Otherwise WP Rocket will not be able to detect the correct URL to update our configuration files.
If you have a folder-based multisite at
www.example.com/site1 and you use domain mapping so that visitors access the site at:
www.examplesite.com ,then you need to log into your site at:
www.examplesite.com/wp-admin and activate WP Rocket there.
Error on Import Settings
The WP Rocket settings file uses a JSON format. In a Multisite environment, JSON is overridden by upload_mimes by default as part of WordPress multisite core. If you see this message:
Error notice: Settings import failed: incorrect filetype.
you'd have to add JSON to the allowed list of Upload file types in the Network Admin > Settings > Upload Settings > Upload file types before you can import the settings file.