Converting a WordPress website to static HTML provides various benefits like speed and security. As WordPress powers almost 43.2% of the internet and has many advantages over other CMS, it has 2 critical drawbacks. First, it’s slow, and second, it’s open to attacks.
To overcome these drawbacks it is often suggested to convert WordPress sites to Static HTML sites. Few suggest using static site generators like Jekyll, Hugo, Eleventy, and others (A great list of Open-Source Static Site Generators by It’s FOSS).
While the above platforms are good alternatives, one might still prefer to use WordPress and want the benefits of a static website, don’t worry we got you covered.
Moving WordPress to a staging environment
You might be thinking why should we move WordPress to a staging environment?
It’s not necessary to move it to a staging environment but it’s recommended. If we keep WordPress on the same server which has the HTML file, then one of the advantages of a static website i.e. lesser area for attack (more secure) won’t be valid as WordPress will still be open to attacks.
So in this tutorial, we will move our WordPress site to a staging environment.
What staging environment can be used:
- A different server that can only be accessed by you or
- Your local computer (which I use personally)
I host my WordPress locally as it is more secure to host it on my PC (it’s not available online to attack but you need to be careful and keep proper backups)
Generating Static Copy of WordPress
We will be using the WP2Static plugin to create a static HTML copy of all the posts and pages of our website.
Once you download the plugin, install it by uploading it to your website. Now open the WP2Static menu and you will see the “Options” tag under the menu. Now at the end of the page, there will be “Post-processing Options”, under which we need to set the “Destination URL”. Set the destination URL to your website URL, In my case, it is “https://yadavgaurav.com”.
Under the menu, the first option is “Run”, which will open a new , you will see “Generate static site” Click it to generate a static copy for your WordPress website.