Table of Contents
How do websites work
Websites have become a part of our lives in that they have become sources of information, be it general knowledge or detailed information about specific topics. Websites are great tools for sharing information about specific topics, a business or even selling products or services directly on the website. Websites are very helpful, but how exactly do they work?
Before we learn how websites work, let us define what a website is and highlight a few of the topmost common types of websites.
What is a website
A website is a collection of pages consisting of text and sometimes images and videos. These pages are written as code and presented to the user as formatted pages on the browser. A website sits somewhere in a folder in a computer that is always on and always connected to the internet. Websites are designed by web designers and developed by web developers who then upload the website and its assets to the webserver.
What are the types of websites?
A very technical person might say that the two types of websites are ‘static website’ – which displays static content such that everyone who visits the website will see the same content, and ‘dynamic website’ which shows dynamic/changing content relevant to the visitor or the time, such websites include news sites or blogs and others.
In the case of this article, we will not talk about these terms but rather talk about the types of the website as in their primary goal.
Here are the three most generalized types of websites, this is not the only types but some types may be easily categorized as subtypes of the following.
a. Business website
A business website is a website created with the purpose of representing a specific business/company online. It shows information about the company such as contact details, address, services offered, and sometimes personnel working for or own the company. Business websites may also have tools built in them to allow booking appointments, sending emails, writing reviews about the company, and even a chat feature where you can chat with the support staff directly on the website.
b. eCommerce website
An eCommerce website is also referred to as an online shop, which is a website that displays products or services and allows customers to buy and pay for services directly on the website. eCommerce websites can sell both physical products and digital services or sometimes both.
c. Blogs
A blog (short for weblog) is an information-sharing website that allows the owner to post articles (blog posts) in the form of text, pictures or videos, or a mix of theses. Blogs have the capability of allowing visitors to leave comments about the blog post.
These are not the only types of websites, but some types can be considered subtypes of the three mentioned above. Some large websites can even have the blog and e-commerce functionality built into one website, so that means a business website, blog, or commerce website does not have to be standalone. You can have a business website that has a blog and an online store.
So now that we have that out of the way, how do websites work?
Now, remembering our definition for a website above. A website is saved on a computer that is always connected to the internet. This computer is known as a server, the server is always on and ready to receive requests to show (serve) a specific website. A server can have multiple websites saved in it, this is called hosting a website. Each of the websites on the server has a unique address called a domain and is in the form www.example.com or just example.com. This domain is linked to a unique numeric address of the server itself called an IP Address (Internet Protocol Address), so when you visit a website you type its domain on the browser and your computer or phone checks ‘translates’ that into the IP address of the server and then makes a request to the server to receive the pages of the website, then the server packages the code, text, images, and links making up the page of the website and returns (serve) it to your computer, which then displays it for you on the browser.
Let us break this process down further by first defining the key terms used here.
Web Server – A computer that stores all the content for websites. A server is always connected to the internet and is always on. A server has a unique address called an IP Address (defined below) used by computers and other devices on the internet to communicate with it. Read more about web servers
IP Address – A alphanumeric string that is the address of a specific server or device connected to the internet. The most commonly used type of IP Address is the IPV4 address type which consists of numbers separated by dots like 192.168.8.1, and most recently IPV6 was introduced which defines addresses consisting of alphanumeric characters separated by colons, like 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Read more about IP addresses
Hosting – Allocating space on a server to store the files of a website. A company that owns the servers for hosting websites is known as a web host.
Domain – a unique address for a specific website. A domain is alphanumeric and is usually in the form of www.example.com or just example.com. This address is intended for humans so they can remember the addresses and identify specific websites. You type the domain of the website on the browser so that your browser can request the website from your server.
DNS (Domain Name Server) – is a type of server that only serves to translate/convert domains into IP addresses. When you try to visit a website using its domain, your computer does not know where that website is and does not know how to connect to a website’s domain name, so it makes a request to the DNS server to ask for the IP address of the website given the domain. Remember, the domain is for humans, not computers, computers use their IP addresses to communicate but we can remember IP Addresses so we use domain names that are translated into IP addresses with the help of the DNS Server in real-time.
Browser – is a computer program or application with an interface for displaying and navigating web pages.
Wow. That is a lot of information but at least we have the basics we need to understand how websites work
Here is a detailed overview of how websites work. So let us simulate a user who wants to visit a website like example.com and see what happens under the hood.
Step 1: Use the browser to specify what website to visit
When you want to read up about something or you want to search for something on the internet, what you would normally do is to open the browser on your device (phone, tablet, laptop or desktop) and type in the domain of the website you want to visit if you already know the domain and then you press the go button or press the Enter button.
If you don’t know the domain, you use a search feature built-in your browser, this feature is usually powered by Google’s Search Engine which is why the process of searching is usually referred to as Googling. Google will return a list of results that point to other websites. Then you will click on one of the links on the search results and this will start the process of visiting the website as if you typed the domain on the address bar.
Step 2: Visitor’s devices consult with DSN Server to resolve the domain into an IP Address of the server that hosts the website.
Remember, the computer does not know how to connect using the domain, so they need to first convert the domain into its IP address. So, once you have clicked on a link or pressed enter after entering the domain. Your computer makes a request to the DNS Servers (configured on your network or manually) to resolve the domain into an IP address. So it goes something like this: Hello DNS Server, I want to visit the website located on the domain example.com, would you please give the IP Address of the server where this website is hosted. And the DNS server checks its records and say, found it, the IP Address is: IP_ADDRESS
Once your computer receives the IP address as a result from the DNS Server, it starts to make a request to the IP Address directly.
Step 3: Computer requests website from Server
So now the user’s device has the IP address of the server, then it sends a request to the server using what is called the HTTP Protocol to communicate with the server. So it goes like this:
Hello, server [IP_ADDRESS HERE], I want to visit the website whose domain is example.com, can you please show me this website.
Step 4: The Server Receives the request and packages the web page
Once the webserver receives the request, it checks its own records to see if indeed the website is hosted on this domain. This could yield a lot of different results but let us assume the website is indeed on this webserver. Then, the web server will find the record of the website and go to the folder where the website is stored and retrieve what is called the index file which is the file that is usually the home page of the website. Once it has found the index file, it packages its code and sends it back to the computer that made the request.
Step 5: The browser receives the page from the server.
Now the browser receives the code from the server, the browser knows how to display the page on its window. If the page has references to resources such as stylesheets and images, then the browser will send another request for each of those files to embed them on the page and then uses its rendering engine to render the page as defined by the code.
Now if the user reads the website and clicks on a link, for example, Contact Us, the browser will now repeat the process but skipping the request to the DNS server because it will cache the results from the DNS server locally and next time it needs to visit the same website, it will grab the IP address form the local storage and request the website from the server directly.
There is a lot that happens under the hood, this is just a general overview of a very simple case. In some situations where the website being visited is very complicated, there may be many communications between the client/visitor’s computer and the server. For example, a website may include/embed resources from other websites like embedding a YouTube video on a page, which means the client computer will also send another request to youtube to view the video.
In some cases, like in eCommerce websites or blog, the posts or product details may be on a database server separate from the web server, in this case, when the web server receives a request to view a blog post or product, it will send its own request to the database server to get the product/blog post, and then it will process it and include it in the code that it will send back to the client-server.
This can be very complicated and may include a lot of back and forth communication. The good news is that this all happens in seconds so we do not need to worry about what is happening in the background. All we want is to view the content we requested.
Now that concludes our article: How do websites work
Now that is how websites work in general. As discussed above, the process seems very simple but involves a lot of unpredictable results. What is good is that technology has simplified it for us and we do not need to worry about what is going on in the background. But if you are interested in learning more about websites and the internet, please subscribe to updates and we will send you an update when we have something to share.
0 Comments