Static vs Dynamic Websites
If you've researched different options for your website, you may have come across the terms static and dynamic when referring to websites and wondered what the difference is.
Static Websites
Static websites are static: once they're uploaded to a server, they can't change until another update is uploaded.
Many people think that a website being static means that no dynamic content can be added to it, but this is not true. A static website can still request additional information from a server after the page has finished loading.
Advantages
Static websites are...
Fast: Because the server doesn't need to do much processing, it can almost immediately send the page to the browser
Additionally, because the images used on each page is known before someone accesses the website, optimized versions of the images can be generated in advance further increasing the website speed
Secure: As there isn't any code running on the server, there's no way to hack a static website without first hacking into the server that hosts it
Easy to cache: Each visitor gets the exact same version of the website making caching easy, even at a global scale (such as when using a CDN)
Disadvantages
Hard to add dynamic features: Because of the static nature of these websites, adding dynamic features (such as logins) is more difficult
Slow to update: Most static websites use a framework to make development easier, but this requires a "build" process to run each time the website is updated which can delay website updates by a few minutes
Lack of personalization: You can't make the website show different content depending on the user location, language, etc.
Dynamic Websites
Dynamic websites run code on the server each time a request is received.
Advantages
Personalization: With a dynamic website, you can show different content based on the user's location, their login status, etc.
Easier to add complex features: Complex features, especially those that require a database, are easier to add to a dynamic website
Disadvantages
Slow: As the server needs to run code (and possibly connect to a database) each time a request is received, dynamic websites can be significantly slower than static websites
Less secure: Dynamic websites have a large attack surface, meaning that they're more likely to be hacked; this happens often with outdated WordPress installations
More expensive: Dynamic websites are more expensive, both in development and hosting costs
Hybrid websites
Hybrid websites have static and dynamic elements to give you the best of both worlds.