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

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 gulp script to package the entire site:
Get the static files generated by WP Super Cache
Copy all assets (images, uploads, etc).
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?

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:
Get a static version with wget (you will need some parameters for recursion, attachment rewriting etc.)
Modify anything you need in the html files (you could use sed for this).
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.

Related

How can I optimize a WordPress website except minifying files and compressing images?

I am trying to optimize a WordPress website. I already minified some js and CSS files. I already tried compressing images and videos and trying to eliminate render-blocking files but the website speed is just the same.
The issue that I found on the website is that it has files that are too long and even I enabled caching, some files are not being cached.
Any information or website that will be helpful to optimize the website?
First of all, take a backup of your site manually
Go to public_html and compress all the files
After that export a copy of the database by phpMyAdmin
Then you can perform the following steps:
Clean the database where there is a lot of data that could be cached You can do this with several plugins (I recommend :WP-Optimize - Cache, Clean, Compress)
After you clean and optimize the database, deactivate this plugin and install the WP Fastest Cache plugin
Include the following options (note that you must turn off any other speed booster plug-ins because including more than one speed plugin can cause negative interference):
-cach system
-preload
-logged-in Users
-Minify HTML
-Gzip
-Drowser caching
-Disable Emojis
*Notice:
preload
Enable – This tells the plugin to preload your pages. Upon firing, you'll get a popup asking you which pages to cache.
Check all the categories – Particularly Home
page, Posts, Categories, Pages
Leave the “pages per minute” at 4
You may need to reduce this number depending on your hosting provider limits.
Leave the “Restart After Completed” option unchecked.*
After you do that, compress the images with any compression plugin (i use smush)
Then go and test your site here https://gtmetrix.com/
This article https://gtmetrix.com/wordpress-optimization-guide.html
I have benefited a lot from it on my personal site and it has reached 96% speed because of these tips
You need to follow the following instructions:
take a backup of your file.
Install a cache plugin like as [https://wp-rocket.me/[1]
minify css,html,js of your wordpress file
This plugin is working fine.

Wordpress old/updated/deleted CSS files are being served minified and I cant delete them. Why?

Backstory
We are using a LAMP stack (bitnami) to run a multisite Wordpress instance. This is the second time I have ran into a file that will not update when we push an update (We use git and pull the latest changes to the bitnami server).
We have noticed that when deleting (renaming for that matter) the file, it can still be retrieved by performing a GET on the resource (or the url in a browser). Also, if we were trying to make changes the changes do not come with the file - it is still the old file. Interestingly enough, the file is minified, which because of issues with this in the past we do not use any plugins that minify our CSS. So there should be no reason for it to be minified.
We have WP Total Cache - clearing all caches is successful but does not stop this from happening. (We used to use WP Super Cache, when this bug happened we decided to change plugins to WP Total Cache and purged the cache and it fixed the problem - but it is back and that no longer works).
I have also seen the trick where we can use a "?ver=###" query param on the url. This works but this would prevent us from using CloudFront for our files (currently disabled for all this testing so its not the problem either). Also I am not convinced it is a long term solution - or a solution at all since these minified files are being created and shouldnt be in the first place.
Additional information
It may not be helpful, but the files we have noticed this with are in a theme folder that is not technically an active theme. We just use the folder for additional resources that we have created ourselves. We reference them in the head of some pages.
Example:
/wp-content/themes/active-theme <- The active theme
/wp-content/themes/resources <- Our custom resources
Questions:
Where is this file being stored?
How can I delete it?
How can I prevent this from wasting our time ever again?
I found that the issue was with the bitnami server itself. The Apache2 module PageSpeed was causing the served files to be minified and cached resulting in the pages never updating no matter what we did on wordpress.
Apache:
To disable PageSpeed, comment out the following lines in your httpd.conf (/opt/bitnami/apache2/conf/httpd.conf)
#Include conf/pagespeed.conf
#Include conf/pagespeed_libraries.conf
Solution found here

How do I keep WP db content synchronized in the filesystem?

I'm looking for an easy way to sync content that is in the Wordpress DB with the file system. Pages and Posts mostly, but any additional content would be great. I'm not looking to cover 100% of the DB content, just the most used configurations.
This is the Wordpress workflow I'm looking for:
Create a file in the filesystem, ie. /repo/posts/mypost.yml
Run a Wordpress command-line, ie. wp sync, which checks for sync status between my filesystem /repo/ and the content in the database.
Differing content from the db is exported and from the filesystem imported.
In case of conflict (double changes in both), ask for merge or whatever.
This is very common with the newer, file-based, CMSs, like Grav, Kirby, Jekyll, etc. but unfortunately, for many reasons, we're stuck with Wordpress.
That way we can use git and edit and version content in a much more robust way.
WordPress already has built-in version control in the database, called revisions. If you use different user accounts, WordPress will even lock pages that are being edited, preventing collisions.
Additionally, you can export the database to an .sql file and store it in your custom theme directory which you should manage with git. You only need to version control your custom theme directory, because all non-custom WordPress files already have version control. However, you can export the database every now and then to keep your git repository complete. Additionally you should ask your hosting provider to create daily backups.
This will give you full version control on everything (git for the theme and WordPress for the content). Developers will be able to take the git repository and rebuild the installation locally, to change the theme. Content can be edited remote in WP, with WP versioning and daily back-ups for security reasons.
Note that exporting your database to an sql file can be done by using a database manager like PHPmyAdmin or Adminer and using the export functionality or by using a WordPress plugin.

How to push wordpress from mamp into hostgator

I have done a blog in mamp and would like to push into hostgator. Must i recreate everything in hostgator like Installing Wordpress on Hostgator. Is there any way i could just push my stuff straight into hostgator without redoing everything in hostgator. Need some suggestion.. Thanks..
It's quite easy to deploy a local version of Wordpress to a live server. First of all, you are right, I would not bother installing a clean copy of Wordpress on your server, you'd then have to totally rebuild the site.
What you need to do is;
FTP all your files from your local machine to the server.
Transfer the whole database from local phpmyadmin to a new database on the server
Change the database connection details in wp-config.php
Make any necessary changes to your default Wordpress .htaccess. What I mean here is that your MAMP site probably isn't in the root but your live site probably will be. If you have SEO permalinks set up then you would remove the Mamp subdirectory from the rewrite rule and the base in the .htaccess. Your host might also require you to add rules here (ie specifying which version of PHP to use etc). You could always install Wordpress using their installer to see if they add any special rules themselves.
All easy so far - now comes my tip. Moving Wordpress databases from your local development environment to live can be a massive pain because Wordpress (and lots of plugin/theme developers) use serialized arrays to store data. So if you do a find-and-replace on the database to replace your old url with the new one, you will disable lots of things like config settings and widgets (text widgets specifically, but there's loads of stuff you end up having to recreate).
Download this file;
http://interconnectit.com/124/search-and-replace-for-wordpress-databases/
and upload it to the server and access it directly in your browser. Run through the quick form and perform a serialized array-friendly find and replace on your database urls. Job done. Good luck.

Wordpress second install in subdomain?

I am having a website redesigned. The designers plan to use Wordpress as the CMS and want a development copy to work with. Thing is, I now have Wordpress installed to run a blog (only) on a subdirectory of my current site.
Soooo...question is: Can I create a subdomain, install Wordpress on there, point it at a separate (new) schema on MySQL and have them use that for the development work? I know I can physically do this, but will anything about running the the WP install scripts on the subdomain screw up the existing production install on the main domain?
The install itself should not create any problems. Personally, I always develop WP sites in their own subdomain, allowing me to do away with the wordpress/ subdirectory.
The most significant hurdle will come when you are ready to move the development site to a new domain and/or place in the directory hierarchy. Although the theme files and their associated CSS, JS, etc., files should be using relative-path references, the database itself may contain hundreds of fully qualified URLs that reference the development domain and/or directory.
There are a number of WordPress plugins that address this problems. The one I am most familiar with is BackupBuddy from ithemes.com. (I'm not a shill, just a satisfied customer.) BB is useful both for performing scheduled backups (full or database-only), but it is also very useful during development and during deployment. There is an included script, importbuddy.php, than can not only take a .zip of a full backup and restore the site, it can also move the site from one directory and/or domain to another.
Note: BackupBuddy is not free, but it is released under GPLv2. You are paying for the support necessary to keep it tracking changes in the WP ecosystem. If you are doing any serious WP work then it is money well-spent. You might suggest this to your designers.
Yes you can do it. It doesn't matter. You can install your new blogs to any directory or subdomain (actually they're directories, too). Also you can use new MySQL databases for them, or you can use same database for your all WP installations (by editing wp-config.php manually), thereby you'll have same content for your all WP blogs.
Technically, yes you can do it.
However, if you have a live domain with public people using it, you are best not developing on either the same domain or server, because:
Mistakes happen. You can break the database or other code.
While you develop, you can affect performance of the server.
Develop on a local machine, or a completely different server, and when you are happy with it, push the code live onto the production server.
if you are planning to make a test copy of the current install on a subdomain which includes separate source code and database the answer is NO it will not affect your current installation.

Resources