Forum Moderators: open
Right now I'm working on a new job site where I want to trim my html to its purest form. In the past, I've always used absolute URL's in my main navigation elements. Well, if my navigation has more than 5 or 6 links, the absolute URL's can add quite a bit of weight to the pages.
What I did with this new site was use the <base href> within the head of my pages. I specified that href as http //www domain.com/ and that's it. I've now shortened my absolute urls to relative paths. Anywhere the term index.htm or index.asp appeared, I stripped it away and left the directory path as the browser will resolve to the index page for that sub directory.
In the instances where it was just index.htm or index.asp, I stripped those away too and just put "/" in their place. That tells the browser to resolve to the root level index page.
Question 1: When formatting the base href, should I include the forward slash after the domain or leave it off since I am including it in front of my relative paths?
Question 2: Forgive me for being naive, but what is the difference between URL and URI? I know what they stand for, but what is the difference in the terminology and why two of them?
Question 3: Can the base href be specified at the server level so I don't have to include that in the head of my pages? I want to trim everything that I can from the code and let the server do whatever it can.
URIs provide a uniform way to refer to thingys even if there are lots of different ways to access those thingys. There are different way to refer to thingys. One could tell people how to get to the thingy (postal address, URL) or one could tell people the name of the thingy (your name, URN) that they are interested in.
URL is the where of a thingy whereas a URN is the name of a thingy. URIs are whatever-way-to-refer-to-a-thingy of a thingy.
thingy, thingy...
[faqs.org...] is a bit more technical and less thingy. ;)
Andreas
You can set the Content-Location header field (section 14.14 in the HTTP/1.1 [faqs.org] spec) to specify an alternative URI for the entity contained in the body of the server´s response message. This will be used as the base URI when there is no base element in your html.
The problem is that no browsers implement handling of that header field. I guess you are stuck with the base element.
Andreas
Could you help us all out and give us a detailed list of the Acronyms used (URL, URI, URN, etc...) and maybe where they should be used in the sense of referring to things? Your contribution would be much appreciated. I'm somewhat of a follower of your replies as you always seem to know all the good techie stuff when it comes to this.
I want to make sure that I use the correct terminology when speaking the lingo. Unfortunately if I tell the client that it refers to a thingy, they may end up just as confused as I do sometimes.
In the instances where it was just index.htm or index.asp, I stripped those away too and just put "/" in their place. That tells the browser to resolve to the root level index page.
... i use these <a href="/"> to specify the root throughout my sites, and i have never defined the base href, whats the purpose of defining the base href ...
...i can see the use in the case of the google cache where they use the base attribute in order to make all the relative links on the cached page work.
... i use these <a href="/"> to specify the root throughout my sites, and i have never defined the base href, whats the purpose of defining the base href ...
Page Jacking
Not long ago someone showed me how they could page jack my domain. But, because I used absolute URL's (or is that URI's) it would not work. They could get the user to the first page and show their domain in the browser, but once they clicked on any of the links, my absolute URL from that link took them to my site.
I'm just wanting to incorporate this feature into any of the sites I manage as they do extremely well in the SERP's. Last thing I need is someone stealing my traffic.
P.S. I'm still green in this area so I may not be explaining this 100% correctly.
Of course, if you're starting all your links with '/', there should be no difference. '/' as the first character in the URL would mean an absolute path, not a relative one.
Do not think that there is no base URI unless you define one. In the absence of any explicit definition the resource´s URI is used to resolve any relative URIs contained within that resource. If the resource is not identified by any URI it may not contain relative URIs.
A URI generally consists of those four parts.
<scheme>://<authority><path>?<query>
A simplified definition of a absolute URI is this:
absoluteURI = scheme ":" ( net_path ¦ abs_path ) [ "?" query ]
A relative URI lacks the scheme part or more:
relativeURI = ( net_path ¦ abs_path ¦ rel_path ) [ "?" query ]
Network paths start with // followed by the authority section.
Absolute paths are those starting with a /.
All relative URIs need to be resolved to absolute URIs prior to performing a request. With absolute paths only the base URIs scheme and authority parts are used to form the new absolute URI.
Relative paths are subject to a more complex processing since ./ and ../ have special meaning and need to be removed from the finished absolute URI (see section 5.2 6) a)-h)).
... i use these <a href="/"> to specify the root throughout my sites, and i have never defined the base href ...
whats the purpose of defining the base href ...
Andreas
'/' as the first character in the URL would mean an absolute path, not a relative one.
Yes, an absolute path to the root directory. But, whose root directory? In the case of DNS Jacking which I also think is referred to as Page Jacking, this '/' takes them to the root page of the Jacking domain. I'm wanting to avoid that by using the base href.
Am I being somewhat dense in this issue? ;)
Could you help us all out and give us a detailed list of the Acronyms used (URL, URI, URN, etc...) and maybe where they should be used in the sense of referring to things? Your contribution would be much appreciated.
That would make a nice x-mas present, wouldn´t it. ;) I´ll see whether I manage to do it until then.
this '/' takes them to the root page of the Jacking domain.
Andreas