WP Ghost with WP Rocket – File Combination, Cache Path Hiding, and CDN Setup

Moved

This tutorial has moved to the new WP Ghost Knowledge Base where each feature is presented in detail.

View on new site

WP Ghost (formerly Hide My WP Ghost) is compatible with WP Rocket. Enable “Change Paths in Cached Files” in WP Ghost so custom paths apply inside WP Rocket’s combined and minified CSS/JS files. WP Rocket’s cache directory (/cache/min/) contains WordPress path references that WP Ghost rewrites automatically. For full path hiding, combine CSS and JS files in WP Rocket’s File Optimization settings.

How to Configure WP Ghost with WP Rocket

Step 1: Combine CSS and JS Files in WP Rocket

Go to WP Rocket > File Optimization. Enable Combine JavaScript files and Combine CSS files. This merges all CSS into one file and all JS into one file, removing individual plugin and theme file references from the source code.

WP Rocket File Optimization showing Combine JavaScript files option
WP Rocket File Optimization showing Combine CSS files option

Step 2: Enable Change Paths in Cached Files

Go to WP Ghost > Tweaks. Enable Change Paths in Cached Files. Click Save. WP Ghost rewrites WordPress paths inside WP Rocket’s cache directory (/cache/min/1/wp-content/ and /cache/min/1/wp-includes/) so they use your custom paths. Processing happens in the background via WP-Cron.

If WP-Cron is disabled on your site, you can trigger the path rewriting manually from the WP Ghost settings page.

Step 3: Map the WP Rocket Cache URL (Optional)

WP Rocket’s combined files are served from the /cache/min/ directory. If you want to hide this cache path too, go to WP Ghost > Mapping > URL Mapping and add a mapping for the WP Rocket cache directory.

WP Ghost URL Mapping showing WP Rocket cache directory mapped to a custom path

Step 4: Purge WP Rocket Cache and Verify

Purge all WP Rocket cache from WP Rocket > Dashboard > Clear Cache. Open your site in an incognito browser, view page source, and search for “wp-content”. No default WordPress paths should appear — including in combined CSS and JS file URLs.


Troubleshooting

Combined files still show old WordPress paths. Purge all WP Rocket cache. WP Ghost processes cached files via WP-Cron — allow a minute after purging. If WP-Cron is disabled, click the manual trigger in WP Ghost settings.

File combination breaks site functionality. Some JavaScript files cannot be safely combined. Test with combination disabled (keep minification on) to identify the conflict. WP Rocket’s “Excluded JavaScript Files” option lets you exclude specific files from combination.

WP Rocket CDN URLs still show old paths. If WP Rocket uses a CDN, add the CDN domain in WP Ghost > Mapping > CDN URLs.


Frequently Asked Questions

Do I need to combine CSS and JS files?

Not strictly required for security, but recommended for maximum path hiding. Without combining, individual plugin and theme CSS/JS file URLs remain in the source code. WP Ghost changes those paths, but the file names still hint at the plugin identity. Combining merges everything into one anonymous file.

Do I purge WP Rocket cache after WP Ghost path changes?

Yes. After any path change in WP Ghost, purge all WP Rocket cache so new cached files are generated with updated paths.

Does this work with WP Rocket’s CDN feature?

Yes. Add the CDN domain in WP Ghost > Mapping > CDN URLs. WP Ghost auto-detects WP Rocket’s CDN configuration for supported CDN providers.

Does WP Ghost modify WordPress core files?

No. Cached file rewriting modifies copies in WP Rocket’s cache directory, not original files. Deactivating restores all defaults.


Hide Paths in CSS Files – how Change Paths in Cached Files works.

URL Mapping – map WP Rocket cache directory and other paths.

CDN URL Mapping – extend path changes to WP Rocket CDN.

Customize All WordPress Paths – configure paths before cache setup.

Compatibility Plugins List – all tested cache plugins.