Software, your way.
How To Get Good Custom Software
(Download)
(PDF)
burger menu icon
WillMaster

WillMaster > LibraryWebsite Automation

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Redirect 301 Versus Redirect 302

In essence, redirect 301 is a permanent redirect and redirect 302 is a temporary redirect.

It seems pretty much cut and dried. And it is, for some implementations. But for others, it's not such a clear choice.

Definition: The redirect code is a status code. When a browser (or a spider/robot) asks for a page, the server may respond with a redirect, sending the browser to a different URL. That response is a status code of either "302 Found" (temporary redirect) or "301 Moved Permanently" (permanent redirect). In general parlance, those status codes are often referred to as (a) redirect codes, (b) redirect 301, or (c) redirect 302, depending on context.

The server can be told to return a redirect code to the browser in any of a number of ways — with PHP, with JavaScript, with an .htaccess file, as common examples. The methods are outside the scope of this article. Type "redirect" into the search box at the willmaster.com site. You'll get a listing of lots of related articles.

Cut and Dried Determination of Redirect Code

If you move a page to a new URL and don't intend to move it back to it's original location, use redirect 301, the permanent redirect code.

If you want to redirect traffic temporarily, use redirect 302, the temporary redirect code. (Examples: Redirect to a certain page only during a holiday. Redirect to an "under construction" page while the original page is being revamped.)

Those are the cut and dried situations.

Less Obvious Determination of Redirect Code

Now, let's look at three situations with some room for maneuvering, where personal preference has some say-so.

But first, a couple things to take into consideration when deciding which redirect code to employ.

  1. Redirect 301 permanent generally causes browsers to update their history with the new URL. Subsequent requests for the old URL are redirected immediately and automatically to the new URL. Redirect 302 temporary should cause the browser to request the old URL every time to see if the redirect is still in place.

  2. Redirect 301 permanent generally causes search engine databases to be updated with the new URL. Redirect 302 temporary should not.

OK, here are three situations where you'll need to make a determination which redirect to use.

One. Page moved. In near future, it'll be moved again.

One way to do this is:

  1. Redirect the original page 301 permanent to the interim page.

  2. When the final page is ready, redirect both the original page and the interim page 301 permanent to the final page. (Both original and interim are redirected because some browsers and search engines may already have the interim URL in their database.)

Another way to do it is:

  1. Redirect the original page 302 temporary to the interim page.

  2. When the final page is ready, redirect the original page 301 permanent to the final page.

The method to use is entirely up to you. The "another way" method seems more logical with less work. But that may not be the case for all implementations.

Two. Using redirecting software (such as Short URL V2) for click counting in email newsletters, ebooks, and PDF documents.

PDFs often are published online where browsers and search engines can follow the links. Newsletters can be published online, too, although it's less common.

Because the purpose of the redirect software generally is click counting, there are different considerations.

These two are general statements, assuming all browsers and readers act the same: Redirect 301 permanent counts the click only the first time for each browser and reader used. Redirect 302 temporary, counts the click every time.

But there's another reason for using redirecting software in newsletters, ebooks, and PDFs. In addition to click counting, it's possible to change the redirect destination URL after publication.

As an example, the destination URL may have a typographical error. The solution is to change the destination URL in the redirecting software. No need to re-send the entire newsletter or re-issue the ebook or PDF (and hope everybody replaces their old version with the new).

As another example, distributed newsletters, ebooks, and PDFs may have a link to an affiliate program you no longer support, but you have another similar affiliate program you now want traffic to go to. The solution is to change the redirect destination URL so future clicks go to the new affiliate program.

Quality redirecting software, like Short URL V2, lets you easily change the destination URL.

However, there's a catch — whether or not browsers and search engines will follow the link to the new URL depends on the redirect code that was provided in the first place.

If redirect 301 permanent was used as the redirect code, browsers and search engines may already have the first (now incorrect) destination URL in their database, in which case it's unlikely those particular browsers and search engines will follow the link to the new URL. Their original instruction was that the redirect destination URL is permanent and there's nothing to indicate they should now look for a different destination URL. Ebook and PDF readers might have similar behavior.

If redirect 302 temporary was used as the redirect code, browsers and search engines, and ebook and PDF readers, are likely to follow the link to the new URL just like you want them to. They never stored the destination URL in their database, as their instruction was that the redirect destination is temporary.

Using redirect 302 for redirect links in newsletters, ebooks, and PDFs can let you effectively change the destination URL as desired.

Three. Links within articles and blog posts.

Articles with links to other websites, whether informational, courtesy, affiliate, or other reason, can also benefit from the use of redirecting software — for the same reasons as newsletters, ebooks, and PDFs — click counting and the ability to change the redirect destination URL when needed.

Linking to other websites comes with a risk. The destination page or the entire site may go 404. Then, articles and blog posts need to be updated with new links — unless links with redirecting software was used.

It's easier, generally, to change the destination URL in redirecting software than it is to change the article or blog post. This is especially true when the link is used in many articles and for articles published at websites you don't control.

Using redirect 302 and redirecting software for links to other websites in articles and blog posts lets you change the destination URL as desired.

You now know how to choose redirect 301 or redirect 302 in special situations. The special situations mentioned may provide enough information for determining the status code to use for your own unique situation.

(This article first appeared in Possibilities ezine.)

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC