Web Addresses
Generally, we can think about “finding” a web location in two ways: via its relative or absolute address (or URL).
What U. R. L(ooking for)
You invite an old friend to visit you, but they don’t know where you currently live. When they ask for your address, you give them your country, state, city, street, and house number.
We find sites and files on the web in the same way, but instead of looking for houses, we’re looking for other computers, servers, files, or even queries on a network. A “web address” or uniform resource locator (URL) is assigned to every website so that users and servers can find that site quickly and easily.
Directions for a site or file can be broken down similarly (in the most basic sense) to directions to a house, but more applicably into protocol, domain, path, and file. The protocol, domain, and path make up the three essential parts of a URL.
Continue to the next page to find out how the web does this.
Anatomy of a URL
The protocol states how the web browser will communicate with a web server (where your files live on the big, bad web). A common protocol is HTTP, or Hypertext Transfer Protocol.
In our analogy, think of the protocol like the “country” of your site's address.
You have purchased a domain for your site: example.com. You may choose to use a common subdomain, www. Altogether, your site's URL is “http://www.example.com”. Domains are unique; if you own example.com, no one else can. It is the main direction to your site and all its content.
In our analogy, think of subdomains and domains like the “state,” “city,” “province,” etc, of your site's address.
Paths are instructions on how to navigate directories. They contain all parent and subdirectories (folders inside folders) found en-route to a destination.
In our analogy, think of the path as step-by-step directions to the final room, which contains a file or page.
The end of a path often leads to a file, page, or even query. There may be lots of files on your website, like the image profile.png for example, found on your “About Me” page. Where this image lives in your directory structure will dictate how other content is able to locate it.
In our analogy, think of these path-enders as the residents living at your site's address.
Directory
If the root (.
) is for example.com
, your directory for that site might look something like this:
. ├── content/ │ └── images/ │ └── profile.png ├── about.html └── index.html
development
- Previous
- Next