Read without ads and support Scribd by becoming a Scribd Premium Reader.
 
URLs (Uniform Resource Locators) are the standardized means of addressing pages inthe Web.Technically, a URL (presumably pronounced like the name of the psychic known for  bending spoons) is any short string leading to a resource that is acceptable for use on theWeb, while it also identifies a specific protocol for retrieving the resource. Though thismeaning is slightly different in case URI, URN, URP, URT & URVs.In the above acronyms, the "U" is sometimes construed as standing for "Universal" rather than "Uniform".URLs have the following form:
http://www.sitename.com/x/y.html
The first part, separated by a colon (:) from the rest of the URL, is the protocol, usuallyhttp for HyperText Transport Protocol, though other protocols such as ftp and gopher aresometimes used. For secure-server sites using an encrypted protocol, https is used as the protocol identifier. Next comes the hostname (domain name or IP address), preceded by a double slash (//). Itseems to be a common misconception that the colon and double slash are an inseparabledelimiter terminating the protocol -- for instance, the Mozilla team posted an onlinedocument regarding their implementation of irc:// URLs. Actually, the colon is theterminator of the protocol section, and the double slash is used to introduce a hostname or other site identifier (varying somewhat by protocol, with some less-common protocolstaking things other than domain names in this section) and is absent in URIs lacking ahostname like mailto: and news: URLs.After that is the directory path to the Web page you're accessing, with forward slashes (/)separating directory levels (not backslashes (\) like in DOS/Windows systems).So
“:// ”
also indicates that all the files of that web page are stored systematically indifferent folders of varied levels.
 Pedantic Note
: Actually, as many purists will tell you, it's not true that the "path" portionof a URL is necessarily a directory path. Servers can be configured to interpret a URL path any way they like, which might not necessarily correspond to any actual  subdirectory tree. Sites generated dynamically from databases may use URL paths that have nothing to do with directory structures. However, most Web servers do use URLscorresponding to the file structure, so that's what I'll assume for this document.
There are a few special protocols with URLs of differing syntax. mailto: is followed withan e-mail address to create a link allowing users to send mail to that address. news: isfollowed by the name of a newsgroup (e.g., comp.infosystems.www.authoring.html) tolet the user follow the link to see the newsgroup's messages (if the user's browser isconfigured to access a news server). Both of these URL types do not have slashes (singleor double) in them; the syntax looks like mailto:webmaster@webtips.dan.info, not
 
mailto://webmaster@webtips.dan.info/; developers used to the more common http:syntax often put extra slashes in these URLs and cause them to fail. (More information onmailto: URLs is in my page on e-mail.) Note that you can't leave out the protocol and use www.somewhere.com as a link URLwithout the http://. This syntax works when you're typing in a URL in most browsers, butin a link within your Web site it will be interpreted as a relative URL to a file named"www.somewhere.com" in the current directory.Are URLs case sensitive?Technically, yes. You should always be consistent in your use of upper or lower case inyour URLs. Even in cases where the upper and lower case versions go to the sameresource, you're imposing an unnecessary burden on browsers that need to retrieve andcache two copies of the same thing if they go to two variants of the same URL.As far as whether you can vary the case and still get the same resource, this depends. The protocol and hostname are not case sensitive, so you can write http://www.dan.info/ or HTTP://www.dan.info/ and they'll work identically. However, the directory andfilenames may be case sensitive depending on what operating system the server isrunning under (UNIX is case-sensitive, while Windows isn't). Fragment names are case-sensitive. So be careful to match the directory, file, and anchor names in your links to thecase of the actual files and anchors.Can I include spaces in my URLs? No, the space is not a legal character in URLs. Spaces, and a number of other specialcharacters, must be encoded by using a percent sign (%) followed by a two character hexadecimal number giving the character's position in the ASCII or ISO LATIN-1encoding. A space is represented as %20.Some Web servers might have file systems that allow documents with names containingspaces, but if you use files with such names, their URLs will contain %20, which is rather ugly. So it's best to avoid such names and stick to safer characters like letters, numbers,dashes, and underscores. Mac users in particular tend to create directory structuresincluding spaces, producing awkward URLs.Relative URLsDefinition: Relative URLs are context-sensitive, giving a path with respect to your current location.There are several types of relative URL.1. A URL with no slashes, like "junk.html", references another page in the samedirectory as the current page. So if you're currently at"http://www.yoursite.com/stuff/one.html" and encounter the relative URL "two.html",this is addressing the page "http://www.yoursite.com/stuff/two.html".
 
2. A URL with no leading slashes, but slashes within, references a subdirectory beneaththe current one. "subdir/test.html", encountered from the same page as the aboveexample, would reference "http://www.yoursite.com/stuff/subdir/test.html".3. A URL with double dots at the start, like "../another.html", references the parentdirectory of the current one. This URL, accessed from the same page as the aboveexamples, would lead to "http://www.yoursite.com/another.html". Double dots can berepeated, like "../../grandparent.html", to go up additional levels, or combined withsubdirectory references like "../sister/" to go to a sibling directory.4. A URL with a single dot at the start, like "./stuff.html", references another file in thesame directory, just like a URL with no slashes. It's better to use the form of URLwithout the dot and slash, since there are a few old browsers and indexing robots thatdon't seem to understand this syntax properly, and end up expanding the URLs into bizarre things like "http://www.yoursite.com/././stuff/../junk/", which work (with mostservers), but look weird in your access logs. Double dots produce this effect too, butthey're too useful to give up, but the single dot is unnecessary (except in the special caseof linking back to the index of the current directory, where "./" is the best URL, asdescribed elsewhere).5. A URL with a slash at the start, like "/dir1/dir2/stuff.html", references a page at a path starting from the root of the server. To be more precise, it starts at the root of thedomain name you're in. Be careful using this if your site is in a virtual domain on anInternet provider's system. If you have a domain yoursite.com which points at thedirectory /sites/yours/ within the ISP's domain provider.com, then your pagesilly/stuff.html can be reached via two different URLs:http://www.yoursite.com/silly/stuff.html andhttp://www.provider.com/sites/yours/silly/stuff.html. Maybe you had your site up for along time before getting your own domain so your users are regularly coming in via bothaddresses. In this case, a URL like "/silly/morestuff.html" can be interpreted as"http://www.yoursite.com/silly/morestuff.html" or "http://www.provider.com/silly/morestuff.html" depending on which domain the user isin. Thus, you should avoid this form of URL if there's any doubt about how the user isaccessing your site.6. In an uncommon but legal URL form, a URL with a double slash at the start, like"//www.yoursite.com/stuff.html", keeps only the protocol identifier from the current URLand gets the full sitename and path from the new URL. I actually found a use for thisform recently, in a piece of HTML code that was being accessed under both the securehttps: protocol and the nonsecure http: protocol, and under more than one domain name. Iwanted to access a particular graphic in all cases, using a protocol (secure or nonsecure)matching that with which the main page was accessed. Using relative URLs of the formsgiven above would require the graphic to be placed in all the different domains; and usingan absolute URL would force the protocol to be specified. I deftly avoided these problems by using a double-slashed relative URL.7. Finally, a URL beginning with a pound sign (#) specifies a link to a fragmentidentifier (anchor) in the current page.Which Type of URL Should You Use?
Search History:
Searching...
Result 00 of 00
00 results for result for
  • p.
  • Notes
    Load more