WP Super Cache to create a static version of the full site

1.1k views Asked by At

I'm working on a WP project where the live site can't use WP (for security reasons). My solution was to build the site on a local server using WP, then export a static snapshot of the site (using WP Super Cache) that can be uploaded to the live server.

I have a script to package the entire site:

  1. Get the static files generated by WP Super Cache
  2. Copy all assets (images, uploads, etc).
  3. Copy other necessary files like .htaccess.

Problem

When using WP Super Cache I've noticed pages are missing from Super Cache. For example, my site has 82 pages but my cache contains only 65.

What are the settings in WP Super Cache so the entire site is cached into the WP Super Cache directory?

Or, is there another plugin better suited for caching all the pages?

1

There are 1 answers

2
Sebastian On

I wouldn't use a caching plugin (or any other plugin) for this as they are not made for this purpose and would need (extensive) modification not only now, but also down the road when the plugin gets updates.

I did exactly what you are planning, on a larger scale of a couple of thousand Wordpress sites. I deployed those sites statically - also for security reasons - with a PHP script that does essentially this:

  1. Get a static version with wget (you will need some parameters for recursion, attachment rewriting etc.)
  2. Modify anything you need in the html files (you could use sed for this).
  3. Copy assets (depending on your needs and on the wget configuration)

With a tool like grunt you could even run more tasks, like minification, uglification and image compression once you finished creating the static copy.