Static vs. Dynamic Websites: What are They and Which is Better?
23 Oct 2020 · 4 min
Ben Kalkman explains the difference between static websites (built from HTML files) and dynamic ones (server-built using PHP and databases). Dynamic sites let you update content across the whole site at once and use a CMS, but take longer to build. Static sites work for small, short-lived projects.
Chapters
You're listening to a Rocket Media Blogcast. Prepare for launch as we share another great episode. Static vs Dynamic Websites what are they and which is better? Websites come in a variety of different shapes and sizes, but one way they can be divided is between static sites and dynamic sites. The difference is not obvious when you're just looking at a website in your browser, but it can make a big difference in the function of your website. Static Websites A static website consists of a series of HTML files, each one representing a physical page of a website. So on a static site, each page is a separate HTML file. When you visit the homepage, you are viewing the actual homepage file. Even if two pages contain a chunk of identical content, like, let's say, a footer, they both contain two versions. So if you want to update the footer, you can. You must do so twice, once on each page. This is fairly straightforward, and it's how all websites were built during the early years of the World Wide Web. Now, let's talk about dynamic sites. A dynamic website uses server technologies such as PHP to dynamically build a webpage, right? When a user visits the page, basically what happens is the user goes to a certain web address and the server finds a bunch of different pieces of information that that it writes into a single cohesive webpage, which is what you see. This way of building web pages on the fly has several advantages. The benefits of dynamic websites, of course. Easier design updates. Since each part of a web page is separate, it's much simpler to update something across many pages all at once. For example, if you have to change your website's navigation, you only have to change it in that one place, the file that holds the navigation information, and it's updated on all the pages that contain that file. If you had a static website, you would have to edit every single page in order to make that change to the site's navigation. This is tedious, repetitive, and of course, prone to errors. More flexible data. Because a dynamic site pulls together a bunch of pages bits to make a whole page, you can store your content and other parts of your site in a database. The advantage of this is that you can easily access and edit your content in a variety of ways, or even have it load across multiple websites. For example, if you had two distinct brands with some overlapping content databases. Also make it easy to search your content, categorize it, load it in dynamic ways, such as displaying the five most recent entries about sock puppets and back it up. All this is nearly impossible with a static site. Easier content updates Dynamic websites with a content management system. CMS make it simple for non technical people to create and update the content of the site. Because the various parts of the page are all separate, a content creator won't need to know any HTML in order to create a new page or article for the site. You can simply concentrate on writing the content and the dynamic site takes care of putting that content into the right spot on the website. With a static site, the content creator would have to know HTML or employee help of someone who does in order to create a new page for our site. So are there any disadvantages to a dynamic site? It really depends on what the purpose of the site you're building is. Dynamic sites may take longer to initially code and develop than static sites. However, in most cases, any upfront savings you may achieve from a static website will be wiped out multiple times over by the additional time you'll need for future updates and revisions. So if the site is simply for a limited time promotion, only has a page or two, and is going to be taken down when the promo ends. It's possible that a static site might be the better option. However, in the vast majority of website projects, dynamic sites pay off in the end.