How to Convert a WordPress Site to a Static HTML Website

Converting a WordPress site from dynamic to static pages is one way of improving speed and reduce security threats. In this article, we will see why and when it is necessary to convert the WP site to a static one, the common methods, and a step by step procedure.

WordPress is a popular content management system that is easy to set up and run by both technical and non-technical people. However, it utilizes a database system and other dynamic website components that can potentially slow down the page load times, or expose it to security vulnerabilities.

You may, therefore, consider converting your WP site to HTML based website if you want to improve speed and security. A static website does not execute database queries, PHP code, and other tasks that take longer and slow page load times. Instead, it loads the HTML pages almost instantly when a user makes a request.

There are several different methods of converting WordPress websites to HTML. You can use a WordPress plugin, such as Simply Static, or a third party desktop tool such as HTTrack.

The basic process involves converting every post and page into a static HTML article. Each of the conversion methods generates HTML files and directories that follow a similar structure as the WordPress website. You can then upload the html files, in the same structure, to a subdomain or the primary domain, and continue accessing it as if it was the original WP website.

Using a WordPress Plugins

WordPress plugins such as the Simply Static and others have the ability to automatically convert each of the WordPress pages and posts into static HTML files.

Using the Simply Static plugin to convert WP to static HTML

  • Login to your WP dashboard
  • Locate and open Add New under the Plugins
  • Type and search for Simply Static in the keyword search field
  • Install and activate the Simply Static plugin

Click Settings to configure how you want to convert the files.

This will give you a screen with three different options for the destination URLs, and a choice of the delivery method.

Choose Destination URL Options available

Use Absolute URLs

You can convert and create HTML files that will work on a different URL or domain. In this case, use the first option and add the URL where you intend to place the static website.

Specify the destination URL where to place the resulting HTML content. This could be a subdomain, directory, or in some situations the main domain URL.

If you want to replace the WordPress on the main domain, use its URL. But note that this will replace your WordPress files and you may need to move them to a different directory.

Relative URLs

This converts you WP website to static HTML files that can work in any website regardless of the name. It gives you an option to include a path, just in case you do not want to put them on the root directory.

Save for offline use

This allows you to convert WP to static URLs that you can save on your local drive or another storage medium. This option will enable you to browse the website offline.

In all the options, you need to specify the delivery method.

Choose delivery method

After you have selected the Destination, go to the Delivery Method and use the drop-down list to choose either a Zip archive or a Local Directory.

Click Save Changes

Generate HTML files

Navigate to the Simply Static section and click Generate. Click Generate Static Files in the window that opens. The conversion process begins and this will take a few minutes or more depending on the size and complexity of the WordPress website.

Once complete, it displays a link of the downloadable, compressed file which you can save locally and extract to the URL where you want to use it, or a local if you want to browse offline.

  • Click on the link provided to download the file to a local drive.
  • Login to cPanel and open the legacy File Manager, you can also use an FTP client. Go to the folder for the URL where you want to load the HTML website.
  • Click Upload

  • Locate the compressed file to upload from your hard drive.
  • Select and upload it to the URL.
  • The process takes some minutes depending on the speed of your internet connection
  • Go to the URL where you have uploaded the file
  • Highlight the file and click Extract to decompress the files. You can also right-click on the file and choose Extract.

Choose the same directory where you want your website. In our case, we use the /testing/ directory in the example.com folder. If you want it in the root domain directory, do so, but ensure that your previous WordPress files, if using the same directory, are in a different location to avoid overwriting them.

Your static website version is now ready to run. If you type its URL at the browser, it should open just like your WordPress site.

Confirm that all links are working.

Using HTTrack to convert WordPress to a static website

HTTrack is an open source tool that downloads an entire website onto a local storage while retaining its structure. As it downloads the files, it creates directories, images and HTML, and other website files, as well as a structure that enables users to browse the website offline.

The mirror site on the local drive has a link structure similar to the original site. The tool is customizable and has the ability to perform updates to keep the offline site the same as the live version.

How to use HTTrack

  • Download the open source tool from http://www.httrack.com/page/2/en/index.HTML  Choose the version compatible with your operating system.
  • Install and launch the application from your computer
  • Give it a name to differentiate it from other websites that you may download in future
  • Choose the Download web site(s) in the Action drop-down list.
  • Enter the URL for the WordPress you want to download in the Web Address (URL) box, you can specify more websites by clicking the Add URL option.
  • Click Next and then Finish starting the conversion and downloading process.

    The HTTrack local site will follow the WP’s permalink structure. It also saves most of the dynamically generated content such as recent posts, comments, related posts and others as HTML.
  • Once the process is complete, you can upload the entire website on a domain or subdomain as well access it offline from your local machine.

Since it saves all the individual files separately, use a compression tool to put the files into one ZIP or RAR file that is easier to download to the website. Use the legacy file manager, or an FTP client, to upload the zipped file in the URL where you want your HTML website. After uploading the file, extract the files in your preferred directory/URL.

Conclusion

The ability to generate HTML website files for you WP website is something you may need to consider if you want to increase the speed and security of your website.

Converting the WordPress website removes the dynamic functions such as comments, contact forms, e-commerce and others that rely on PHP.

As such, you may consider third-party tools such as Discuss or Facebook for comments, as well as other third-party solutions to perform the dynamic functions a static website does not provide.

 

Check out these top 3 WordPress hosting services:

or click to check out the full list of top WordPress hosting companies

Was this article helpful?