Why and How to Create a Static Website with WordPress
What can’t you possibly build with WordPress? You can build all types of websites ranging from small blogs to large e-commerce websites.
It’s the reason why WordPress is the platform of choice for millions of businesses across the globe, including big-name brands.
WordPress is straightforward to use and comes with many customization options in themes, page builders, and plugins.
Additionally, the platform enjoys a huge community of contributors and supporters across the globe. There are many reasons why WordPress is a staple, but we won’t get into that.
And that’s all because WordPress generates what we call dynamic webpages.
If that sounds confusing, my friend, it is. So, what’s the difference between a static website and a dynamic website? Well, to shed some light, I will explain how WordPress works and how static websites work. Let’s begin with static websites, ladies and gentlemen.
If I were to explain, we would need an entire web design course. When you have a few minutes to spare, check out the guides I linked above for more info.
WordPress, on the other hand, is a platform that generates webpages on the fly. You don’t code pages from scratch. Just log into your WordPress admin, enter your content, and hit the Publish button.
Then the almighty PHP kicks in and retrieves your content from a database that runs on MySQL or something else, such as MariaDB. Yeah, I know, but read on.
WordPress takes care of everything else, bringing different parts together to build the page you see in your browser.
It’s much like what Microsoft Office does when you create a document. Just enter the content, and Microsoft Office handles everything else. You don’t code the document from scratch.
That said, you have a couple of tools to create a static version of your WordPress website. I mean, you can either use a plugin or a cloud-based service.
That’s what I love the most about WordPress; there is always a workaround. You either get a plugin or service to sort you out. I’m yet to find a problem I can’t solve using plugins or third-party services.
But before we get lost in all this, why would you create a static version of your WordPress website? What are the benefits?
Why Create a Static Website with WordPress
In summary: Every WordPress website runs hundreds of tasks before creating the page you see in your browser, which slows down everything.
Your WordPress website also runs on thousands of files from the WordPress core, theme, plugins, and third-party integrations. That’s not all; your WordPress website connects to multiple endpoints, creating multiple security holes for hackers.
A static website, on the other hand, doesn’t operate in the same manner. It can run without connections to a database, which makes it faster. Additionally, there are few (if any) endpoints meaning you have better security. Plus, you’re not prone to common WordPress errors, such as the infamous “error establishing database connection” error.
Now, the long read.
Here’s why a static website is a viable workaround. Remember, we are not saying you completely nuke your WordPress install. You’re just creating a static version so that you can enjoy the following benefits.
Faster Page Load Time
Can a WordPress website work without a database? Nope. Can WordPress work without Apache or PHP? Again, nope. WordPress cannot run without many server-sided tasks that a static website can do without.
Things worsen if you are on shared hosting, where resources are spread thin across millions of websites. If you do your marketing right and start attracting lots of traffic, a WP website on shared hosting will suffer.
To create the page you see in your browser, WordPress makes numerous roundtrips to the server and executes a ton of PHP commands, among other things.
The commands plus the trips take time. It might be milliseconds, but when you have a large (and popular) website, it’s significant enough to slow things down and cause high bounce rates.
Static websites don’t need to process dynamic pages, eliminating roundtrips, which saves you page load time. What happens is you get faster page load speeds, which is always welcome, especially when Google rewards faster websites. Plus, faster pages improve user experience (UX), translating into better conversion rates down the line.
Pro Tip: You can speed up your WordPress website using a service like WP Rocket, choose better hosting, and cleaning trash on your site.
SQL injection is a looming threat that takes down site after site – to the millions. And WordPress isn’t spared because it runs on a database that isn’t immune to SQL injection, more so if you don’t harden your WordPress security.
On top of that, some WordPress plugins may expose your site to security risks (such as XSS attacks), especially if you download plugins from questionable sources or fail to run regular updates.
A static version of your website doesn’t have this vulnerability because there are no plugins to hack. Plus, no PHP (which executes on the server) code is running. You also don’t need to connect to a database 🙂
By all means, the WordPress version of your site still has these security problems, but you can choose to hide WordPress from attackers using the .htaccess file.
Just hide the WordPress version behind a .htaccess password and serve the static website in its place. And then continue creating content in WordPress and pushing changes to the static site.
Pro Tip: You can make your WordPress site invulnerable to security risks by practicing better site hygiene (check out the article linked above) and staying pro-active with WordPress site backups.
Needless to say, no digital asset (read, websites, mobile apps, etc.) is 100% immune to attacks, so stay vigilant.
Less Management & Maintenance
Managing a website is no easy task. Running a healthy WordPress website is even tougher. Many running cogs need constant oiling, as we saw in the WordPress maintenance checklist.
For starters, you must keep your WordPress installation up to date, or you’ll court the bad guys. Besides, newer themes and plugins require the latest WordPress version, meaning you’re missing out on great features.
N/B: If you had no idea, outdated themes and plugins expose your site to attackers, especially if they have known security vulnerabilities.
Additionally, you have to optimize your pages for faster load speeds, which can throw you a curveball when minifying files or using WordPress caching plugins and CDNs. If you’re a beginner, it’s tough. I know; I have been there.
With a static website, you have none of that. You don’t need to update the WordPress core, themes, or plugins, which means less maintenance on your part.
Aside: But you must keep updating your WordPress core, themes, and plugins, even if you have a local install on your PC. It is good site security hygiene.
You also don’t have to worry about page load speeds, even if you’re using shared hosting. On top of that, a static version of your website has better security, as we mentioned earlier, which is one less thing to worry about.
Pro Tip: Always update your WordPress core, themes, and plugins to stay ahead of cybercriminals and for the best functionality. For better page speeds, check out how to decrease WordPress page load time.
We all want to create websites that attract a ton of visitors. After all, traffic is the lifeblood of every successful website.
Without traffic, your website is practically dead. You created a website so that the world could find you and your business, and that’s good.
Now, WordPress is quite a scalable platform. It can handle everything you throw at it, whether you’re a small business owner with a dozen web visitors or a huge e-commerce line with millions of views per month.
But if you have a traffic spike and you’re on shared hosting, for instance, your WordPress website will run into problems since many tasks are running in the background (tasks a shared hosting package can’t handle).
Many simultaneous visits to your WordPress website at once can knock out your server or database since many processes are running.
On the other hand, a static website can scale easily whether you have ten or a million hits at once. Why? Because there are no roundtrips to the server and database.
In other words, virtually no server-heavy processes are running, meaning many visits at once won’t knock you out. It might still happen, but not as often as with a WordPress website because – roundtrips and processes.
What that means is you can comfortably host on budget hosts or even free on GitHub (or other free hosts) without any hiccups. Your static website will still work even if you get a spike in traffic, which might take out your WordPress website on the same hosting package.
Pro Tip: It is advisable to go with a great WordPress hosting company from the start. Managed WordPress hosting and cloud hosting are two viable options if you want to scale effortlessly.
These are some of the benefits of creating a static version of your WordPress website. Now, let us move on to the fun part; creating a static version of your WordPress website.
I tried a couple of plugins, and they all failed miserably. Some haven’t been updated for years, and others require compiling Github source code, which is definitely not for beginners. It was so frustrating until I found StaticPress2019, and I can smile again.
How to Create a Static Website with WordPress
For some context, I’m working with the following sample site, which is one of the ready-made demos that come with the Total WordPress Theme:
The WordPress demo site lives on: design.vistamedia.xyz.
We will create a static website that we’ll host on a different sub-domain (i.e., static.vistamedia.xyz) that currently looks like this:
Don’t worry; it’s just an empty directory on my server without any website files. That’s where we will store the static version of our WordPress website.
N/B: I’m using sub-domains for illustration purposes only. You can use any other domain or URL you like.
But before we go on, here are a few things to keep in mind. For starters, this workaround is not for all WordPress websites.
It’s great for simple websites, such as:
- Online brochures that don’t need complex functionality
- Basic portfolios
- Purely informational websites
- Coming Soon pages and landing pages
- Sites that are prone to attacks, e.g., political and celebrity sites
- Websites that must be really fast
And that’s because converting a WordPress website into a static website knocks out server-sided functionality, such as:
- e-commerce plugins
- Most slider plugins
- Default WordPress comment forms
- Server-sided contact forms
- All plugins that use a submit form
- Event plugins
- Membership plugins
- “Most Popular Posts”-type widgets
- RSS feeds
- And any other plugin that needs a server to function
An e-commerce site running on WooCommerce will suffer when you convert it into a static website because WooCommerce creates dynamic pages that require PHP and server-side functionality.
However, there are many workarounds to get the functionality you need. For instance, you can use Disqus for comments, Algolia for search, and Snipcart for e-commerce. There are workarounds for the other features, but you have to ask if it’s worth the time and effort.
That said… let us see what the StaticPress2019 plugin can do.
How to Create A Static Website With StaticPress2019 Plugin
StaticPress2019 is available in the WordPress plugin repository, which means we can install it inside the WordPress admin dashboard.
Log in to your WordPress admin, and navigate to Plugins > Add New:
Next, enter StaticPress in the keyword search box, and once you find the plugin, click Install Now:
After that, Activate the plugin. So far, so good, you’re doing just fine.
Next, click StaticPress2019 Options on your WordPress admin menu, as we highlight below.
Next, enter the URL and document root of your static website and click the Save Changes button.
In my case, I’m using static.vistamedia.xyz and /home/vistxxxx/static.vistamedia.xyz, respectively. Use the values applicable to your case.
Next, click StaticPress2019:
On the next page, click the Rebuild button, as shown in the following screengrab.
Wait out the process to run its course. It can take time, depending on the size of your website.
Once the process is over, you can pop the bubbly because that’s all there is to it 🙂
But wait. Don’t forget to test your static website thoroughly! You can view your new static website in the front-end.
Here’s how our final result at static.vistamedia.xyz, which looked like this earlier…
You can’t tell the difference. Mind you; it’s way faster than the WordPress version on the same hosting package 🙂 And everything is there, including photos and blog posts, responsive design, and so on.
The StaticPress2019 plugin is great for creating static websites from new and old WordPress websites.
Remember: If you update your WordPress website, you have to navigate to StaticPress2019 and click the Rebuild button, as we did a few seconds ago. Doing so will push the changes to the static version of your website 🙂
If you’re creating a new WordPress website that you’d like to convert to a static website later, you can consider using a paid service (just search “WordPress static site generator” and you’ll find plenty of options). Such services offer static websites and built-in workarounds for comments and search forms, typically along with hosting, at a monthly fee.
As we said earlier, there are always workarounds for such features when using a plugin such as StaticPress2019. That means you don’t have to pay to create a static version of your WordPress website, especially when it’s this straightforward.
Creating a static website with WordPress has its pros and cons. You enjoy faster page load speeds, better security, fewer admin tasks and have more hosting options at your disposal.
Simultaneously, static websites are not ideal for all WordPress websites, such as e-commerce sites that rely heavily on WooCommerce.
And that’s because server-side functionality is obliterated when you convert a WordPress website into a static website. Things like contact forms, order forms, comments, and carts won’t function.
While there are workarounds to get the functionality you need, it’s always important to consider if you truly need a static website. It’s easy to create, for sure, but are you better off with a WordPress website running on stellar hosting, for instance?
Why don’t you give StaticPress2019 a shot and let us know what you think in the comment section? Happy creating and stay safe!
By combining WordPress with some of the responsive WordPress themes and best WordPress plugins available, you can create a website that looks great and includes all the functionality you need.
WordPress is great. It help (especially) for SME to compete with big company. Converting pure cms WordPress to static is another great help to SME who host their website at the low cost hosting
I tried installing the Staticpress plugin but it gave me an error.
Do you know of any other plugin I can use?
Thanks though, because it is really well written this article
Maybe give the Simply Static plugin a try?