Think of it from your viewpoint, as a browser on the edge of the Internet. When you click a link
<a href="/somepage.html">Some Page</a>
<a href="http://example.com/somepage.html">Some Page</a>
What actually happens when you click the two links?
In both cases, your browser executes a request for http://example.com/somepage.html.
So in respect to faster or slower, there is . . . zero difference.
The non-full URL makes the actual page smaller by a few bytes (or kilobytes, with a lot of links) so the page itself will load faster.
However, I've got my usual "two cents" about this:
I found many blogs about this and some say C is best and few say A is best because of SEO or maintenance.
I'll forgo the SEO comment, as there may be things I don't know about in that regard. It seems to me this is the same issue as my example, a link on a web site's page is still http://example.com/somepage.html. However, maintenance wise, IMO the statement about A couldn't be further from the truth, and here is why.
Consider the following:
So from index.html, href="about.html" is fine.
But from gallery/project-one-name/index.html, the directory-relative link to about is usually found as:
Which works. OK, now let's look at the CSS and JS for the same page:
<link rel="stylesheet" type="text/css" href="../../../css/sitename.css">
OK that works too. But lets compare it with the same files from root:
<link rel="stylesheet" type="text/css" href="css/sitename.css">
Boss says "no, move that to root, not in the gallery directory."
You have to re-code them.
But if you always use this,
It doesn't matter where
in your file system a file exists. The forward slash means "Start at this domain's root and link along this path." It is the equivalent of assigning http://example.com/ to every single link you create.
Look at the following, using this concept:
<link rel="stylesheet" type="text/css" href="/css/sitename.css">
A file containing those domain-relative
links can be moved anywhere: root, gallery, project-one-name, 20 directories deep, and it will always work. Without having to chase toothpicks. So the idea that this
is "less" maintenance than this
is only true if your site has no directory structure to speak of, in which case it really doesn't matter.
Second, this gets really REALLY important if you start using mod_rewrite. Let's say you have an SEO friendly URL,
That actually rewrites to
The URL is still "top of the domain," right? But any links in your PHP script have to do this . . .
To link back to home. One you will have to change on a case-by case basis,the other . . . well it doesn't matter if you hard code it or not, it remains the same across the site.
This becomes really important in a custom 404 script, because it can occur from **any** directory, and in order to make the links back to home, about, etc. work, you have to do one of the two: full URL or domain-relative linking.
One last reason I don't like the full URL: if you have a particular template or cloned scenario, let's say, three sites that act differently, you can just move this
from domain A to domain B without changing a single thing.
There is one down-side to this: When developing a page on your local computer,
/these-links won't work. Your computer is not a web server so doesn't know what to do with /. But once developed, you do a quick S & R of href=" and replace with href="/ before uploading.
There is one time you **need** to use the full URL: when moving to and from a secure location.