URLs and the Index Page
Some basics to understand before delving too deep into Web sites are: URLs and the system for recognizing the default or home page in each folder. A URL, or Uniform Resource Locator, is the address to your Web page. You’ll see this in the address bar in your browser window when you visit a Web site, and this is the link you copy when you want to share a Web site or file.
The first part of the URL is called the protocol or scheme. Hypertext Transfer Protocol, or HTTP, is the most popular. It tells the browser how to handle the page to be opened. For example, the browser requests a connection to a port on the server which hosts the Web site, and the server sends a message back with the Web page information. A few other types of common schemes are https, for secure connections, mailto, for emailing, and File Transfer Protocol, or FTP, for Internet file transfers.
The next part of the URL is the server name. This shows the company or organization storing /providing the information. The server name ends in two or three letters, called the domain name. Two letters indicate a country like .us for the U.S. or .uk for the U.K. Three letters usually indicate .com for a company, .org for an organization, and so on.
After the domain, there is the path, or folder(s) where the information is contained, and finally, the file name. In the image above, the scheme is http, the domain name is goodhygienecode.com, the outermost folder is “wp-content,” followed by “uploads” inside of it, a folder called “2014″ inside of that, then a folder called “04,” and finally we arrive at the file called, “Minneapolis-300×300.jpg.”
URLs are absolute or relative. Relative links are used for linking pages within the Web site, and absolute links are used to link to an external Web site. Absolute URLs include the entire path to the file, such as the example URL above, and can be compared to a detailed street address. Relative URLs direct the browser to a location in the current Web site. For example, a contact page in the Web site might be called contact.html. You could create a link for the contact page within any of the Web site pages by typing <a href=”contact.html”>Contact me</a> in the HTML code. When a visitor clicks on that link called “contact me,” the browser will take them to the contact page.
Finally, if a URL is typed into the browser bar with a path but no file name, most servers will look for a default page in each folder called index.html. This page is also called the root or top level of the Web directory. This is the page that users will see first, so it is typically the home page of the Web site. Therefore, when creating the home page, save it as index.html. In the next blog, we will cover how to create an article with links that allow a user to jump around from top to bottom of the page, called “anchor links.” Happy clean coding!