Getting started Tips for web professionals

How to convert a WordPress site into a static site

WordPress logos and padlocks floating on a salmon-colored field

WordPress is by far the most widely used content management system (CMS) for putting content on the web. Today, WordPress is used by 42.9% of websites in 2022 and 64.1% of the market of CMSes used for created websites.

The popularity of this CMS is due to its modularity: with the ability to install plugins and themes in just one click, with hundreds available options, enabling the creation of a showcase website for your business, a personal blog, as well as an e-commerce site. However, using multiple plugins also has its downsides, the proliferation of database requests that can slow down a website and cause security issues  being prime among them.

To avoid these problems and improve your website’s performance, how about exploring all the advantages of a static HTML site?

Thanks to Valère, hosting support manager, for these tips.

What’s a static website?

A website is considered “static” when it is composed of static webpages. The typical webpage these days is generated when a user visits the page. This page is called “dynamic,” which is to say that it adapts to information provided by the user (IP address, local time, language, etc.). In contrast, a static webpage is written in HTML (or CSS) and is more or less unique for each user. Static web pages, then, are faster to load and thanks to the fact that they don’t access databases or execute code, they are safer.

This type of website can be implemented in two ways: by directly creating a static website or by converting an existing “dynamic” site into a static one.

An easy solution is to implement on your Simple Hosting instance, with WordPress installed on a staging/preproduction address and static pages on the definitive address for your website.

Are you looking to create a “Stage/preproduction” version of your website in order to do crash tests before applying to your main site? Find out how to create your own subdomains!

The advantages of a static website

  • security from the unique character of each page, resulting in fewer possible security flaws
  • improvement in access time for your website (quick loadtime)
  • taking into account the Varnish cache on the front end of your web hosting
  • use less of your Simple Hosting instance’s resources (CPU/RAM)
  • staging (you can test and modify your WordPress site before deploying it on your production site)

Limits to using a static website

  • if you intend to use WordPress’s comment system
  • if you want to use WordPress’s search feature
  • if you install e-commerce or user management plugins, or those that require dynamic features

How to create a static website using WordPress

Now we’ll explain how to implement a static website from WordPress since, as explained above, it’s the most used CMS.

Depending on your specific case, you have two options:

  • You already have a WordPress website already online
  • You don’t have a WordPress website yet

Installing WordPress on a web hosting instance

If you’re installing a WordPress on a web hosting instance, the easiest way is to follow our tutorial video that guides you step by step:

Otherwise, here’s a quick summary!

A website has two pieces:

  • Web hosting (a server that “stores” your website)
  • A domain name (unique and easy to remember) that corresponds to your site’s URL

With Gandi’s “integrated WordPress” solution, you can directly buy your hosting, link it to your domain name, and preinstall WordPress as well as a TLS / SSL cetificate to secure your site, all completely automated, without any technical expertise required.

If you already purchased these products separately, we invite you to read this page from our documentation which explains how to link a domain name to your web hosting.

If you opt to create a subdomain for a backup in the event that your static website does not work out (which we strongly recommend), repeat the same operations for the definitive address of your website and its subdomain.

Finally, it is, therefore, important to limit access to your WordPress installation to you alone or to your teams by following this procedure.

Now that your WordPress site is configured, let’s look at how to generate a static website.

Implementing a static site with Simply Static

For that, we’ll use the Simply-Static plugin that you can install directly from the WordPress plugin menu.

Once the plugin is installed, we can look at how to configure it. You’ll find these settings in your WordPress dashboard: Simply Static -> Settings.

On the General page:

  • Choose “Use absolute URLs’ and indicate the static website address you want
  • Method used: local directory
  • Local directory: /srv/data/web/vhosts/domain.tld/htdocs/ (the root directory of your static website).

Verify the configuration of the plugin using the diagnostic tool and address any warnings.

Finally, go to generate your website’s static pages. This operation can last a few seconds, depending on the amount of content available on your website.

You’ll need to perform this operations every time that you update the content of your website via WordPress in order to deploy it.

In order to improve the SEO of your static website, don’t forget to add a 404 error page, a sitemap, and a robots.txt file that you will be able to add from the Simply Static advanced settings.

And there you go! Your WordPress site is now a static website! Now you can improve the security and load speed and save money on your hosting.