A static website is an ideal format to archive a WordPress site because it is a plain HTML copy of the website. It doesn’t require PHP and MySQL, so the website is hack-proof and very fast. Here are step-by-step instructions on how to convert a WordPress website into a plain HTML, static website with the Simply Static plugin.
![](https://blogjunkie.net/wp-content/uploads/sites/4/2017/12/Simply_Static_Plugin-700x328.png)
Step 1: Prepare your website
Since the static website will not have PHP, it won’t be able to process dynamic actions like form submissions. Disable or replace comments and contact forms with hosted alternatives (e.g. Disqus and Wufoo respectively).
Infinite scroll and dynamic “Load more” post functionality will be unavailable too, so convert your pagination to plain next/previous or numeric links.
Update the content to be an evergreen version of the website. Maybe you want to remove the dates from your posts. Remember, the website is going to stay like this forever (or for a very long time at least).
Deactivate all unnecessary plugins. You won’t need security and utility plugins any more.
Finally, backup your website. You never know when you may want to revive it.
Step 2: Generate a static copy of your website
![](https://blogjunkie.net/wp-content/uploads/sites/4/2017/12/simply-static-menu.png)
Install and activate the Simply Static plugin. Here are my recommended settings:
General
- Use relative URLs
- Local directory delivery method
If your website is in /home/user/public_html
, consider using /home/user/static_html
as the output directory.
Include/Exclude
Simply Static will only generate your public posts and pages. This means that if you have a hidden page that is not linked to from the navigation or within your site, it won’t be included in the output. If you want these pages, make sure that you are including any hidden pages in the settings.
Now go to the Diagnostics page and make sure you have green lights across the board.
If all is good, go to Generate and click the Generate Static Files button. Simply Static will take a while to generate your static site.
Step 3: Preview and fix problems
Since we output our static site to /home/user/static_html
, we’ll need to create a subdomain to view it. Create a domain like static.yourwebsite.com
and point it to that directory. Here’s how you would do it in cPanel:
![](https://blogjunkie.net/wp-content/uploads/sites/4/2017/12/static-subdomain-700x350.png)
Now you can visit that URL to preview your static site.
Missing files
If there are missing files in the static site, update the Simply Static settings and include the URL to the file. Delete the generated site and generate a new copy. The missing file will now be included in the static site.
Search and replace URLs
If you need to search and replace URLs in your static site, you can do it with the following command:
grep -rl oldstring somedir/ | xargs sed -i 's/oldstring/newstring/g'
Source: Replace a String in Multiple Files in Linux Using Grep and Sed
Step 4: Go live
Happy with your site and ready to go live? Just 2 more steps:
- Rename
public_html
topublic_html_backup
- Rename
static_html
topublic_html
You could also delete the old WordPress site completely if you’ve backed everything up. Enjoy your new static website.
Contact Form you may try https://formspree.io/