EverWeb Widgets

Relative & Absolute File Paths

Relative Paths
A relative file path is the URL to any file contained in the website's root folder from any other file in the same root folder. A relative path from a page in one directory to a page in another would look like this …
../directory-name/page-name.html
… where page-name is the name of the file that is being linked to and directory-name is the name of the containing folder
These differ from the absolute path which starts with the domain name …
http://www.domain-name/folder-name/page-name.html
Absolute paths will not work unless the file is upload to a server.
Relative paths do not need this part of the URL …
http://www.domain-name/
… and their main advantage is the fact that the file will load faster than one in the same website which is referenced using an absolute path.
Relative Path Examples
The ROOT directory is the folder which contains all the files and folders for the website. If two pages are in the root folder the path inserted into the hyperlink is simply …
page-name.html
If the page containing the hyperlink is in the root folder and the page the hyperlink points to is in a directory, the path is …
directory-folder-name/page-name.html
When the page containing the hyperlink is in a directory and the page the hyperlink points to is in the root folder, the path will be …
../page-name.html
The ../ creates one backward step out of the folder.
When the page containing the hyperlink is in a directory and the page the hyperlink points to is also in a directory, the path will be …
../directory-folder-name/page-name.html
… so the path backs out of one folder and then goes into another.
Home Page & The index.html File
The home page is the first page at the top of the left column in EverWeb and requires special attention when creating file paths. So that the browser can open the home page when a visitor enters the domain-name.com, the file name for the home page needs to be "index.html". Although the home page can be named anything at all, EverWeb changes the actual HTML document name to "index.html"
When creating an internal link to the home page it is necessary to use index.html and NOT page-name.html
The absolute path to the home page is http://domain-name.com
Absolute File Paths
An absolute file path is the URL to a page or file from anywhere on the world wide web. It includes the domain name like this …
http://domain-name.com/directory-name/page-name.html
Although an absolute URL can be used to interlink pages with the same root folder, it's not very efficient since it creates more server requests and eats into the monthly bandwidth allowance of cellular mobile device users.
File Names
It's very important to realise that every file used in a website forms part of a URL. The file name must NOT contain any spaces or special characters such as an apostrophe.
File names should be descriptive for SEO and the words should be separated by a hyphen rather than an underscore so that they are easier to read.
The search engine spiders don't care if you use underscores but they tend to become invisible to humans when the hyperlink itself is underlined.

© EverWeb Widgets -