Abbreviating Yahoo.com

Yahoo! was one of the first sites on the web to employ URL abbreviation. As one of the most popular pages on the web, Yahoo! does everything possible to save bandwidth and maximize speed. Yahoo! uses unquoted abbreviated URLs to squeeze their home page down to the bare minimum, which violates (X)HTML but still works (see Figure 19.1).

Figure 19.1. Yahoo.comabbreviation central.
graphics/19fig01.gif

Yahoo! created mod_rewrite rulesets that allow URLs like this:

Computers_and_Internet/

To be abbreviated into this:

r/ci

But why stop there? You also can represent multiple directories with short abbreviations. So instead of this:

Computers_and_Internet/Internet/World_Wide_Web/

They do this:

r/ww

Behind the scenes, Yahoo!'s webmaster created a mapping file or RewriteMap that looks something like this:

 r/bs  http://dir.yahoo.com/Business_and_Economy/Shopping_and_Services/  r/jo  http://dir.yahoo.com/Business_and_Economy/Employment_and_Work/ r/ci  http://dir.yahoo.com/Computers_and_Internet/ r/ww  http://dir.yahoo.com/Computers_and_Internet/Internet/World_Wide_Web/ ... 

Using mod_rewrite, a binary hash version of this RewriteMap , and a RewriteRule similar to the one discussed in Chapter 17, Yahoo! can serve up abbreviated links that automatically expand on request.

Here's a truncated version of Yahoo.com's home page before abbreviation. So instead of this:

 <a href=http://dir.yahoo.com/Business_and_Economy/Shopping_and_Services/>Shopping</a>,  <a href=http://dir.yahoo.com/Business_and_Economy/Employment_and_Work/>Jobs</a> ...<br><br><font size=3 face=arial><a href=r/ci><b>Computers & Internet</b></a></font><br> <a href=http://dir.yahoo.com/Computers_and_Internet/Internet/>Internet</a>, <a href=http://dir.yahoo.com/Computers_and_Internet/Internet/World_Wide_Web/>WWW</a>, <a href=http://dir.yahoo.com/Computers_and_Internet/Software/>Software</a>, <a href=http://dir.yahoo.com/Recreation/Games/Computer_Games/>Games</a>...<br><br><font graphics/ccc.gif size=3 face=arial><a href=http://dir.yahoo.com/Education/><b>Education</b></a></font><br> <a href=http://dir.yahoo.com/Education/Higher_Education/>College and University</a>, 

They do this:

 <a href=r/bs>Shopping</a>,  <a href=r/jo>Jobs</a>...<br><br><font size=3 face=arial><a href=r/ci><b>Computers & graphics/ccc.gif Internet</b></a></font><br><a href=r/in>Internet</a>, <a href=r/ww>WWW</a>, <a href=r/sf>Software</a>, <a href=r/ga>Games</a>...<br><br><font size=3 face=arial><a href=r/ed><b>Education</b></ graphics/ccc.gif a></font><br><a href=r/un>College and University</a>, 

Yahoo! saves over 8.3KB (over 28 percent) by abbreviating the 273 links on their home page. [1] Note that Yahoo! uses subdomains for nearly all their links, making redirects all the more effective. Redirects save space, and help distribute the load.

[1] Andrew King, author calculation of abbreviated Yahoo.com home page size (30 May 2002). 30,177 bytes21,639 bytes=8,538 bytes=28.3 percent smaller.

 



Speed Up Your Site[c] Web Site Optimization
Speed Up Your Site[c] Web Site Optimization
ISBN: 596515081
EAN: N/A
Year: 2005
Pages: 135

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net