Transcript File paths

Types of links
File paths & directory
structures
hit125 application concepts
Types of Links
Other web pages
URL for another Web server
Your web pages
Same site: Identifies other web pages
stored on the same webserver – need file
name & path
Within a page
Links within same X/HTML document
hit125 application concepts
Absolute addresses
Absolute links
An absolute link defines the location of the
document absolutely including:
the protocol to use to get the document,
the server to get it from,
the directory (folder) it is located in,
and the name of the document itself.
eg- http://www.mcgraw-hill.com/products/books.html
hit125 application concepts
Pathways
Absolute pathnames
href=”/home/users/html/frost.html”
 Web Server
 home
 users
 html
 frost.html
href=”/D|html/poetry/frost.htm”
 Web Server
 D|
 html
 poetry
 frost.htm
href=”/Hard Disk 2/HTML
Poetry/frost.html”
 Web Server
 Hard Disk 2
 HTML poetry
 frost.html
hit125 application concepts
Absolute links
Issues
•Linking from external sources –
out of control of web developer –
external site could be down or
address changes
•Link rot - error 404 – file not
found
•Domain name or IP address
•eg http://204.151.55.44
http://www.mcgrawhill.com/
IP code harder to maintain
Less meaningful to user
and coder
Difficult to update IP easily
hit125 application concepts
Relative links
•
Relative pathways (preferred)
– Indicates where the resource is in relation to the current
page
• <a href=“index.html”>home</a>
•
A relative link takes advantage of the fact that the server
knows where the current document is.
– to link to another document in the same directory, we
don't need to write out the full URL.
– we only need to use is the name of the file
•
Allows sites to become transportable with the least amount of
Web designer effort
hit125 application concepts
Key: Directory (folder)
All Web files go here
wwwroot
File
http://www.spiderland.com
index.html
<a href=“c:/wwwroot/arachnids/spiders.html”>Spiders</a>
<a href=“arachnids/spiders.html”>Spiders</a>
arachnids
<a href=“../index.html”>Home</a>
spiders.html
<a href=“spiders.html”>Spiders</a>
scorpions.html
hit125 application concepts
Link pathways
Relative pathnames
href=”poetry/poem.html”
href=”../poem.htm”
 Web Server
 Web Server
 poetry

 poem.html

 poem.html
href=”lit/poetry/poem.htm”
href=”../../poetry/poem.html”
 Web Server
 Web Server
 lit
 poetry
 poem.html


hit125 application concepts

 poetry
 poem.html
hit125 application concepts
Naming files
hit125 application concepts