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.

Yahoo! created mod_rewrite rulesets that allow URLs like this:


To be abbreviated into this:


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


They do this:


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

 r/bs  r/jo r/ci r/ww ... 

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's home page before abbreviation. So instead of this:

 <a href=>Shopping</a>,  <a href=>Jobs</a> ...<br><br><font size=3 face=arial><a href=r/ci><b>Computers & Internet</b></a></font><br> <a href=>Internet</a>, <a href=>WWW</a>, <a href=>Software</a>, <a href=>Games</a>...<br><br><font graphics/ccc.gif size=3 face=arial><a href=><b>Education</b></a></font><br> <a href=>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 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
Year: 2005
Pages: 135 © 2008-2017.
If you may any questions please contact us: