Home » Beware HTTP Redirects for SEO and Performance – carefully use URL redirection for SEO and web performance

Beware HTTP Redirects for SEO and Performance – carefully use URL redirection for SEO and web performance

Summary:

Standardizing on an authoritative URL form is a best practice for search engine optimization and performance. Avoid duplicate content and first byte delays by canonicalizing your URLs.

HTTP redirects or URL forwarding is a technique for redirecting one URL to another. Often used for avoiding broken links in new sites, or abbreviating URLs, HTTP redirects are a convenient way to preserve traffic and avoid 404 errors. Used incorrectly, however, redirects can cause SEO and performance issues.

What is an URL Redirect

In Apache redirects can be accomplished with the mod_alias or mod_rewrite modules. To redirect one url to another you can use a configuration file or the .htaccess file thus:

Redirect 301 /oldurl http://www.sample.com/newurl

 

The redirect directive of the mod_alias module takes two arguments, the old URL and the new URL. The above redirect instructs all browsers to direct all requests from /oldurl to www.sample.com/newurl. The 301 signifies a permanent redirect, 302 (the default) signifies a temporary redirect.</p<>

What is Canonicalization of URLs?

Canonicalization is the normalization (or standardization) of multiple urls to a single dominant version. For example:

http://www.example.com
http://example.com
http://example.com/
http://www.example.com/?=…

All of the above urls refer to the example.com home page, but a search engine will only consider one of them to be the canonical version of the URL. Having standardized URLs is important for computer security and SEO.

SEO and URL Canonicalization

In search engine optimization you want to avoid duplicate content, and diluting your backlinks and pagerank. What you don’t want are backlinks pointing to both the non-www and www. versions of your URLs. One way to avoid this is to use a 301 redirect to standardize on one version of your domain. To redirect from non www to www. urls you can use the following code in your .htaccess file.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteRule (.*) http://www.domain.com/$1 [L,R=301]

 

Substitute your domain name for domain.com of course. So requests to http://domain.com will be redirected to http://www.domain.com, standardizing the URLs on the www. version.

One Problem with Redirects

One issue we ran into in a recent performance audit was with a 301 redirect going the other way, from www. to non-www URLs. Figure 1 shows the waterfall graph of the target site:

waterfall-before

Figure 1: Waterfall Snippet Showing Redirect from www. to non-www

Note that the www.example.edu is redirected to example.edu, with the associated delay. The TTFB is 1.27 seconds in this case. Redirecting the non www. version to www. resulted in a waterfall graph shown in Figure 2.

waterfall-after

Figure 2: Waterfall graph showing single home page load after redirect

The TTFB dropped to 0.63 after the redirect. This technique avoids multiple delays shown in Figure 1. The slower the server response, the slower the results will be with the first version.

Conclusion

Standardizing on an authoritative URL form is a best practice for search engine optimization and performance. Avoid duplicate content and first byte delays by canonicalizing your URLs.

Further Reading

Abbreviate URLs with mod_rewrite
We look behind the screens at Yahoo and Webreference to see how using short abbreviated URLs and mod_rewrite can save space for maximum speed.
Canonical URL Tag
Moz.com shows how to use the new canonical url tag for search engines.
Redirection 3XX
Part of the HTTP 1.1 specification.
SEO Advice: Url canonicalization
Matt Cutts weighs in on url canonicalization.
URL Redirection
From Wikipedia.

Leave a Comment