WP Ghost is fully compatible with WP Rocket. WP Rocket is one of the most popular premium WordPress caching plugins, handling page caching, file optimization (minify and combine CSS/JS), lazy loading, database optimization, and CDN integration. To use both plugins together while keeping WP Ghost’s path security intact, you need to enable WP Rocket’s file optimization, then turn on WP Ghost’s Change Paths in Cache Files option. WP Ghost automatically detects WP Rocket and creates the necessary URL mapping for the cache paths. This guide walks through the complete configuration.
Why WP Rocket Needs WP Ghost Configuration

WP Rocket generates combined and minified CSS/JS files stored in its cache directory (/cache/min/). These files contain references to your original WordPress paths. Without WP Ghost coordination, the optimized files expose your WordPress structure in their URLs (/cache/min/1/wp-content/ and /cache/min/1/wp-includes/). WP Ghost handles this automatically by detecting WP Rocket and creating URL mapping entries, but you still need to enable Change Paths in Cache Files so the content inside cached files also gets updated.
Step 1: Enable WP Rocket File Optimization
Configure WP Rocket to minify and combine your CSS and JS files:
- Go to WP Rocket > File Optimization.
- Enable Minify JavaScript files to reduce JS file size.
- Enable Combine JavaScript files to merge all JS into a single file.
- Enable Minify CSS files to reduce CSS file size.
- Enable Combine CSS files to merge all CSS into a single file.
- Click Save Changes.


Tip: Combining files reduces HTTP requests but may cause issues on some sites if JS/CSS files have dependencies. Test your site after enabling combining – if specific scripts break, exclude them from combining in WP Rocket’s File Optimization settings rather than disabling the feature entirely.
Step 2: Enable Change Paths in Cache Files in WP Ghost
Tell WP Ghost to rewrite the paths inside WP Rocket’s cached files. Without this step, your combined CSS/JS files still reference the original WordPress paths.
- Go to WP Ghost > Advanced > Tweaks.
- Find Change Paths in Cache Files.
- Toggle it ON.
- Click Save.

WP Ghost runs a background WP Cron job that processes cached files and updates the paths automatically. For complete configuration details, see Change Paths in Cached Files.
Important: After enabling this option, clear the WP Rocket cache so the next page load creates fresh optimized files with the updated paths. Go to WP Rocket in the admin bar and click Clear Cache. If WordPress Cron is disabled on your site, you can manually trigger the path update from WP Ghost’s settings.
Automatic URL Mapping for WP Rocket
WP Ghost automatically detects WP Rocket and creates URL mapping entries to handle the cache directory paths. By default, WP Rocket’s combined files live at URLs like /cache/min/1/wp-content/ and /cache/min/1/wp-includes/, where 1 is the site ID. WP Ghost maps these to your custom paths automatically.
You can verify and customize these mappings at WP Ghost > Mapping > URL Mapping.

Automatic detection: You don’t need to create these URL mappings manually. WP Ghost detects WP Rocket on activation and creates them automatically. If you change your WP Ghost custom paths later, the URL mappings update when you save settings.
Verify the Setup
- Visit your site in an incognito/private browser window so you get freshly cached content.
- Right-click and select View Page Source.
- Search for
wp-content/pluginsandwp-content/themes. They should NOT appear – you should see your custom WP Ghost paths instead. - Check that combined CSS/JS file URLs don’t contain
/cache/min/1/wp-content/– they should use your custom paths. - Run a Security Check in WP Ghost to confirm all settings are applied.
Troubleshooting
Cached pages still show wp-content paths
The WP Rocket cache hasn’t been cleared since enabling Change Paths in Cache Files in WP Ghost. Click the WP Rocket icon in the admin bar and select Clear Cache. Visit a few pages while logged out to regenerate the cache with the updated paths.
Combined CSS/JS URLs still show /cache/min/1/wp-content/
Check that the URL mapping is in place at WP Ghost > Mapping > URL Mapping. If no WP Rocket mappings appear, re-save your WP Ghost settings – this triggers the automatic detection. If the mappings exist but paths are still visible, clear both the WP Rocket cache and your browser cache.
Site looks broken after enabling Combine CSS/JS
This is a common WP Rocket issue, not a WP Ghost conflict. Some JS/CSS files break when combined. In WP Rocket File Optimization, use the “Excluded Inline JavaScript” and “Excluded JavaScript Files” fields to exclude problematic scripts. Test which files cause the issue by excluding them one at a time.
WP Rocket CDN serves old paths
If you use WP Rocket’s CDN integration, purge the CDN cache after changing WP Ghost paths. The CDN serves cached versions from edge servers that won’t update until purged. Go to WP Rocket > CDN to manage your CDN settings.
Frequently Asked Questions
Does WP Ghost automatically detect WP Rocket?
Yes. WP Ghost automatically detects WP Rocket and creates URL mapping entries for the cache directory paths. You don’t need to configure the URL mapping manually. The mappings update automatically when you save WP Ghost settings.
Do I need to clear WP Rocket cache every time I save WP Ghost settings?
Yes, whenever you change paths in WP Ghost. Cached files contain the old paths until regenerated. Clear the WP Rocket cache after any WP Ghost path change to ensure visitors see the updated paths immediately.
What if I use WP Rocket’s CDN integration?
If you use WP Rocket with a CDN (Cloudflare, BunnyCDN, KeyCDN, or WP Rocket’s own CDN), you also need to purge the CDN cache after enabling WP Ghost path changes. The CDN serves cached versions from edge servers that won’t reflect the new paths until purged.
Does this work with WooCommerce?
Yes. WP Ghost is fully compatible with WooCommerce and WP Rocket works with WooCommerce too. WP Rocket automatically excludes cart, checkout, and account pages from caching by default.
Does WP Ghost modify WordPress core files?
No. WP Ghost writes rewrite rules to .htaccess (Apache) or hidemywp.conf (Nginx) and uses WordPress hooks for application-level changes. No core files are modified. Deactivating WP Ghost restores all defaults instantly.
Related Tutorials
WP Ghost with cache and performance plugins:
- Change Paths in Cached Files – Detailed configuration of the WP Ghost cache rewrite feature.
- WP Ghost and LiteSpeed Cache – Another cache plugin compatibility guide.
- WP Ghost and Autoptimize – Another optimization plugin compatibility guide.
- Compatible Plugins List – All cache and performance plugins tested with WP Ghost.
- Emergency Disable – Recovery via FTP if needed.