Change Paths In Cache Files

WP Ghost offers a robust feature that enhances security and compatibility with cache plugins by changing paths in cached files. This guide will walk you through enabling and configuring this feature step-by-step.

When a cache plugin is installed, it stores CSS, JS, and HTML content in the cache directory. WP Ghost automatically scans and modifies these cached files to obscure sensitive paths. Key aspects of this feature include:

  • Runs automatically in the background to change the paths.
  • Does not impact loading speed.
  • Compatible with all WordPress cache plugins.

Activate Change Paths In Cached Files

  1. Go to WP Ghost > Tweaks.
  2. Switch on the Change Paths In Cached Files option from the sidebar to change the paths in all cached CSS, JS and HTML files.
Activate Change Paths In Cached Files

If your cache directory is not located at /wp-content/cache directory, for non-standard cache directories, follow these steps:

  1. Go to WP Ghost > Tweaks.
  2. Click the Set Custom Cache Directory link o add a custom cache directory.
  3. Enter the location of the cache directory so that WP Ghost can look for the cache files on that directory.
  4. Click the Enter key to save the changes.
Set Custom Cache Directory

Compatibility

WP Ghost is pre-configured to work seamlessly with major cache plugins:

  • LiteSpeed Cache: Automatically hides the cache directory to prevent exposure.
  • WP Rocket: Automatically modifies paths to hide plugin details.
  • Autoptimize: Automatically identifies the cache path directory.

See the entire cache plugin comptibility here.

For other cache plugins, WP Ghost uses universal detection to manage path changes effectively.

Hide Cache Directory

  • Enable the URL Mapping feature to further hide cache plugin paths.
  • Change the cache directory using URL Mapping.
  • This maps the cache directory URL to a custom name, making it harder to detect the caching plugin.
Hide Cache Directory

Conclusion

WP Ghost’s path-changing feature works seamlessly with most cache plugins, improving compatibility and security.

To make sure the paths are changed, always test changes in a private window to avoid browser cache issues.

Troubleshooting

The paths from CSS and JS are not changed in frontend after activating this option

This is because the page content was not loaded from cache and it WP Ghost needs up to a minute to change the paths in the cache files.

Solution:

  • Enable preloading cache in your cache plugin if your cache plugin supports it. Preloading applies changes immediately, avoiding the need to wait for visitors to load pages.
  • What a few minutes for WP Ghost to change the paths in cache or click on Change Paths Now button to manually change the paths.
  • Use a Private Browsing Window to test the changes and prevent browser cache interference.