WP Super Cache oopsiedoodle

Yeah, so why does WP-Super-Cache have to hard-code it’s file paths into the PHP to work correctly? What I’m talking about here is -content/advanced-cache.php which is created by wp-super-cache when you activate it the first time. That would be all well and good, but it chooses to use absolute file-system paths based on your individual server’s layout.

Why is that bad? Well consider this: IND-Web.com recently migrated all it’s files to a different directory on the server to allow for better maintenance. Unfortunately this new directory was not the same path as the old directory and therefore the hard-coded path in advanced-cache.php was no longer correct, which meant that WP-Super-Cache was broken.

The real crux of the issue, though, is that there is absolutely NO mention of this in the wp-admin dashboard or even in wp-super-cache’s setup screen. The only evidence of the problem was an HTML comment at the base of every page which informed of the situation. While you might think that’s good, it’s not, because of two reasons: 1) it informs hackers that they are able to more effectively DDoS your server and 2) HTML comments are invisible in the rendering of the page and are only seen when you “view source” in your Web Browser.

This lack of visibility of the problem meant that IND-Web.com, along with THM.net were both completely un-cached and susceptible to floods of traffic overloading the processing capability of the server through re-creating each page upon every visit; as opposed to creating once when each page is updated and then serving the static cached copy to subsequent requests instead.

Join the conversation

2 Comment

  1. It’s only an issue if you move server and copy files over which in terms of the install base of WordPress sites is a rare occurance, but sorry you didn’t notice things weren’t cached.

    Unfortunately the path is hard coded because that file is loaded very early in the PHP process, and I think before WP_CONTENT_DIR and WP_PLUGIN_DIR are defined so they can’t be used :(

    If you have any ideas about how to fix it please email me or post to the wp-super-cache forum on WordPress.org!

  2. I’d prefer to leave it as-is, but I’ll define a constant that can be checked, and display a warning in the dashboard if there’s a problem.

    Thanks for posting about this!

Leave a comment

Your e-mail address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.