flash service

High_Performance_Web_Sites

Issue link: https://read.uberflip.com/i/1146286

Contents of this Issue

Navigation

Page 102 of 169

Alternatives to Redirects | 81 Connecting Web Sites Imagine the situation where a web site backend is rewritten. As often happens, the URLs in the new implementation might be different. An easy way to transition users from the old URLs to the new ones is to use redirects. Redirects are a way of integrat- ing the two code bases using a well-defined API: URLs. Connecting an old web site to a new one is just one manifestation of this common use for redirects. Others include connecting different parts of a web site and direct- ing the user based on certain conditions (type of browser, type of user account, etc.). Using a redirect to connect two web sites is simple and requires little additional coding. Several of the redirects in the Google Toolbar page load (shown in Figure 11-2) are used for just this purpose—to connect web sites. There are different parts of the backend web site (T4, firefox, and FT3). As new versions of the backend compo- nents are released (such as T5 and FT4), they can be linked to the main web site by simply updating the redirects. Although redirects reduce the complexity for developers, it degrades the user experi- ence, as described in the earlier section "How Redirects Hurt Performance." There are alternatives for integrating two backends that, while creating more work for developers than a simple redirect, are not daunting and improve the user experience: • Alias, mod_rewrite, and DirectorySlash (described previously in the "Missing Trailing Slash" section) require committing to an interface (handlers or file- names) in addition to URLs, but are simple to implement. • If the two backends reside on the same server, it's likely that the code itself could be linked. For example, the older handler code could call the new handler code programmatically. • If the domain name changes, a CNAME (a DNS record that creates an alias pointing from one domain name to another) can be used to make both host- names point to the same server(s). If this is possible, the techniques mentioned here ( Alias, mod_rewrite, DirectorySlash, and directly linking code) are viable. Tracking Internal Traffic Redirects are often used to track the flow of user traffic. This is seen on the Yahoo! home page (http://www.yahoo.com) where many of the navigation links are wrapped by a redirect. For example, the URL for the Sports link is http://www.yahoo.com/r/26. Clicking on this link results in a 301 response with the Location set to http://sports. yahoo.com/. The traffic patterns of people leaving Yahoo!'s home page can be dis- cerned by analyzing the web server logs from www.yahoo.com. In this case, the num- ber of people leaving to go to Yahoo! Sports is equal to the number of /r/26 entries in the logs.

Articles in this issue

Links on this page

Archives of this issue

view archives of flash service - High_Performance_Web_Sites