Issue link: https://read.uberflip.com/i/1146286
Alternatives to Redirects | 79 8. This seventh image request results in a 302 response with the Location http:// toolbar.google.com/intl/search.gif. 9. The final three images are requested. The first four HTTP requests (redirect, HTML, script, and redirect) are used to get the user to the desired HTML document. These redirects account for more than half of the end user response time. Redirects are used frequently. Table 11-1 shows that 7 out of 10 top U.S. web sites use redirects—2 on the initial page and 5 when you navigate to secondary pages. Per- haps one or more of the redirects in the Google Toolbar page could have been avoided. Let's look at some typical uses of redirects and alternatives that don't have such a negative impact on end user response times. Alternatives to Redirects Redirects are an easy way to solve many problems, but it's better to use alternative solutions that don't slow down page loading. The following sections discuss some of the typical situations in which redirects are used, and alternatives that are better for your users. Missing Trailing Slash One of the most wasteful redirects happens frequently and web developers are gener- ally not aware of it. It occurs when a trailing slash (/ ) is missing from a URL that should otherwise have one. For example, the redirect illustrated in Figure 11-1 was generated by going to http://astrology.yahoo.com/astrology. This request results in a 301 response containing a redirect to http://astrology.yahoo.com/astrology/. The only difference is the addition of a trailing slash. Table 11-1. Redirects used across 10 top web sites Web site Uses redirects http://www.amazon.com No http://www.aol.com Yes—secondary page http://www.cnn.com Yes—initial page http://www.ebay.com Yes—secondary page http://www.google.com No http://www.msn.com Yes—initial page http://www.myspace.com Yes—secondary page http://www.wikipedia.org Yes—secondary page http://www.yahoo.com Yes—secondary page http://www.youtube.com No

