The 301 status code is arguably the most important one when it comes to search engine optimization. The
largest part of this chapter is dedicated to this status code, and to exercises demonstrating its use. But
before getting to the exercises, the following sections examine the 302, 404, and 500 status codes. These
are important to understand as well.
The 302 status code is a bit ambiguous in meaning. It indicates that a resource is “temporarily” moved. The
old URL is not obsolete at all, and clients will not cache the result unless indicated explicitly by a
header. To confuse things even further, 302 is also used for some paid advertising
links, but that is not the usage discussed here.
The big problem with the 302 status code is that its meaning for search engines depends on its context.
In practice, it is worth dividing them into
temporary redirects, that is, from a page on domain A
to another page on domain A, and
temporary redirects, from a page on domain A to a page on
Browsers always abide by the definitions for interpreting a 302 redirect — both internal and external.
However, today, most search engines (Google and Yahoo! included) only use it for an
an internal 302 redirect, then, search engines will not cache the result of the redirect, and continue to
list domain A in the SERPs. This is consistent with the definition.
External 302 redirects are more of a problem. Matt Cutts of Google states that more than 99% of the time,
Google will list the result with the destination result, that is, domain B, instead of domain A. This is against
the standard, and Google behaves like this to mitigate a vulnerability called “302 hijacking.”
302 hijacking refers to the practice of using a page on domain A to link to a page on domain B, which
has fresh quality content. Typically, that page would rank well based on that “stolen” fresh content
from domain B, and employ a form of cloaking to redirect users to another page. This practice became
prevalent enough to warrant a change in policy from both Google and Yahoo!, and, according to Matt
“Google is moving to a set of heuristics that return the destination page more than 99% of the time. Why
not 100% of the time? Most search engines reserve the right to make exceptions when we think the source page
will be better for users, even though we’ll only do that rarely.”
In the article at
Matt Cutts discusses external 302s. In this case, the RFC definition is not the rule — it is the exception!
For the most part, external 302s are treated as 301s, but they do not affect the transference of link equity.
In practice, on a dynamic site, you should evaluate whether 302s are necessary anyway. If you want a URL
to host some different content than the usual temporarily, it is better to change the content transparently.
Possible implementations include using an
, or fetching and displaying the alternative content
remotely, obviating the need for the 302 in the first place. To do this you can use the cURL functions in
PHP — Client URL Library.
Supposing the old page was called
, and the page that contains the required content is
, you could simply include the content from the latter page as follows:
Chapter 4: Content Relocation and HTTP Status Codes
c04.qxd:c04 10:40 82
Bitcoin Gambling - The Original Crypto Dice Game