Forum Moderators: open

Message Too Old, No Replies

Relative vs Absolute Links - Which is Slower?

         

bzgzd

12:34 am on Feb 8, 2010 (gmt 0)

10+ Year Member



Hi.

I am trying to find out what is best to use for internal links on my site (for example for my menu navigation).

I see 3 options:
A) href="page.html"
B) href="/page.html"
C) href="http://www....com/page.html"

I found many blogs about this and some say C is best and few say A is best because of SEO or maintenance.

But my question is are those options same from performance point of view?

downhiller80

4:13 am on Feb 10, 2010 (gmt 0)

10+ Year Member



I always use B, unless the subdomain is different, in which case I obviously have to use C. For example, I serve all of my js/css/images from subdomain "a" instead of "www".

vivalasvegas

8:07 am on Feb 10, 2010 (gmt 0)

10+ Year Member



I use A and B, never C because I always pay close attention to how fast my pages load.

JS_Harris

9:00 am on Feb 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you click it and end up where you want it's all good. Search engines don't care anymore and can find your grandmas apple pie if she leaves it in the window.

Solid anchor text is still important but you could even leave a link UNlinked and it will still get followed and found in search.

leadegroot

11:41 am on Feb 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I always give anchors a domain name, so:
http://example.com/somepage.html
(Mind you, I am an old programmer, so in all probability it is:
http://<?php echo SITEURL.SITEPATH; ?>somepage.html
)
but includes are just rooted, so:
/css/style.css
/im/background.jpg
Driven by a hatred of ../../../../ (wait.. did I need another one, or one less?) and laughing heartily at the scrapers (yes! you might take my content, but it'll look like crap and link back to me! Hahahaha!)
*cough*
Could someone pass me my medicine?
;)

downhiller80

1:35 pm on Feb 10, 2010 (gmt 0)

10+ Year Member



"I use A and B, never C because I always pay close attention to how fast my pages load."

I'm a byte-counter too. Won't find any whitespace in my html pages! It's a bit OCD really...

This is why I've started using C for images/js/css though, if your site has any cookies (googleaanalytics/PHPSESSID for example) you actually SAVE bytes, as you can set the resources up on a different subdomain that the cookie doesn't apply to, so the cookie doesn't get sent with each request for the objects. You set your cookie to exist on the www. subdomain only, rather than the whole domain, and you're set. Use fiddler to see what I mean/test your implementation if you try to do this.

[developer.yahoo.com...]

ronin

4:00 pm on Feb 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I use b) over a) because it enables vastly simpler site maintenance.

I use b) over c) because it plays in favour of a higher content-to-code ratio.

ogletree

2:40 am on Feb 11, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Absolute links are best to make sure you get links when people scrape your page. I saw a forum once where somebody just did a view source and pasted it into a forum post to show people something.

g1smd

3:53 am on Feb 12, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



So, it appears generally most people think using option A is bad, and choose either B or C: with B preferred for portability and code brevity, and C preferred as a protection against scrapers.

Brett_Tabke

2:36 am on Feb 13, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month Best Post Of The Month



I am slowly moving to A.

History: We've had this (rel vs abs) discussion about yearly for the past 10 years here - search for it.

I was always a full absolute URL kinda guy. I still prefer that I guess, but my coding is slowly moving to A for easier maintenance.

> load speed

Those that have gzip compression turned on, may actually see smaller pages and faster load time by using absolutle full urls (think about it and how compression works). It is the rare case when More might be Less.

g1smd

10:36 am on Feb 14, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I don't find 'A' easier in any way. If anything, I might have expected 'B'.

tangor

12:10 pm on Feb 14, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm one of the oddies, I guess. Still code "relative". Can't seem to change horses in midstream... Meawhile giggle, bingo and whaho as well as ask can still find all the bits and pieces. My comment on site development performance, not a suggestion...

Lorel

12:38 am on Feb 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've been using full urls for all navigation and relative links for all images. that way if the page gets scraped the urls still work and the images don't load. Yes the scrapers can "fix" the URLs but I suspect that scrapers are basically lazy and avoid sites that will cause them more work. I've done this to about 50 sites now and rarely find a scraper doing major damage.

winwinmantra

8:50 am on Mar 5, 2010 (gmt 0)



SEO point of view, the best practice is to use full URL (http://www.example.com/index.html). The reason is, it helps the search engines. A full URL is always better than writing ../../index.html

If you are not focused towards SEO then go for Option B. It is easy to maintain.

Hyder

[edited by: engine at 2:07 pm (utc) on Mar 5, 2010]
[edit reason] See WebmasterWorld TOS [/edit]

rocknbil

7:14 pm on Mar 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard winwinmantra, this was discussed a few pages back . . . as far as the SE's are concerned, http://www.example.com/index.html and / are equivalent. Second, in terms of SEO, you don't want to do this:

http://www.example.com/index.html

or this

/index.html

Because these give you duplicate content:

http://www.example.com/index.html
http://www.example.com/

or

index.html
/

are two separate URL's. Use / or http://www.example.com/ in all references back to the "main page."

piatkow

9:16 am on Mar 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I started with A because my sites were hosted by my ISP without my own domain names and I knew that I might have to move them at a future date. Initially I hadn't even learned that you could do B.
Now that I own my own domains I prefer C but still tend to go for A out of sheer force of habit.

phranque

9:44 am on Mar 9, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



brett sez:
Those that have gzip compression turned on, may actually see smaller pages and faster load time by using absolutle full urls (think about it and how compression works). It is the rare case when More might be Less.

this is pretty cool - i never bothered to study the specific technology of gzip before.
for those who prefer not to geek on gzip compression, in layman's terms it means that with LZ77 compression any repeated patterns cost very little and with Huffman coding the most frequently used symbols are represented by the shortest bit strings.

kaled

5:46 pm on Mar 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RE: GZIP

If compression is done on the fly, without caching, the additional CPU load could hit site performance, i.e. using gzip could actually make things worse (unless you are desperate to reduce bandwidth and run a site with few images, etc.).

Given that the vast majority of web pages are now served via broadband connections, using gzip is only guaranteed to help if the site uses static html and compressed pages are cached internally so that unnecessary repeated compression operations are avoided. Even in this case, performance gains will be marginal.

Kaled.

MatthewHSE

5:19 pm on Mar 11, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Kaled, I found massive loading benefits using on-the-fly GZIP on my HTML, PHP, CSS and JS files. I've used .htaccess to parse those file types for PHP, and just include some PHP in the files themselves to do the compression. I can see where there might not be any benefit with smaller file sizes or on a really busy server, but in my case it's been nothing but benefit.

penders

11:42 am on Mar 12, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Those that have gzip compression turned on, may actually see smaller pages and faster load time by using absolutle full urls (think about it and how compression works). It is the rare case when More might be Less.


I think 'might' needs to be stressed here. IMHO, I see no way that if you are serving all your content from the same domain that absolute URLs (C) would compress more than root relative URLs (B). The longest repeating pattern is already removed and the same (but smaller) repeating patterns remain.
This 49 message thread spans 2 pages: 49