How To Do a 302 Redirect

How To Do a 302 Redirect

 

302 redirects (temporary redirects) are not often used because in most cases a 301 redirect (permanent redirect) is a better choice. So, what is the advantage of a 302 temporary redirect? A 302 redirect will not permanently pass the reputation and credibility of the original URL to the new URL. As a result, when you remove the 302 redirect the original URL will have a significantly better chance of regaining its previous ranking glory (whatever that may be).

Here are some reasons why a 302 redirect would be used:

  • A website is having technical difficulties so they 302 redirect the main URL (i.e. www.xyzname.com) to a backup website (www3.xyzname.com) while they work on the existing site.
  • In rare situations a business may choose to use a shorter URL such as xyzname.com as their branded home page URL and then 302 redirect visitors to the more complicated database-driven URL alphabet.xyzname.com/home.php?pid=home. The benefit is, if Google allows this, the business can show the XYZ.com in search results because it will not pass the link credibility it is building to the redirected URL and the URL looks a heck of a lot better in search results than the complicated version.IMPORTANT: This is not a recommended tactic but there are rare occasions where a content management system (CMS) will force this issue; especially in some Fortune 500 environments where technical flexibility is a foreign concept. Also note we are not even sure this tactic works any more!

How to Temporarily Redirect One Page to Another Page

  1. If you are not familiar with managing a website from a technical standpoint you should simply tell your webmaster to create the redirect. Just tell him/her the old address and where the new address is and they will take care of it for you.
  2. If you are going to handle this on your own please pick the type of server your website is operating on below and proceed with the appropriate instructions.

— Websites on Unix/Apache Servers

  1. FTP into your website and in the root folder, download, and then create a copy of the .htaccess file and save it in a backup folder so you can restore from a file you know works if you make a mistake.
    Note: If you cannot find your .htaccess in your FTP file list see this tutorial and if it does not help please contact your server administrator for help.
  2. Open the .htaccess in a program such as Notepad++ (a free program) then prepare to type on a new line at the bottom of the existing code.
  3. Put in the redirect based on the following example (pay close attention to the spacing between the words) redirect 302 /OldPage.html http://xyzname.com/NewPage.html
  4. Save and Upload the file to your server and test the redirect by going to the old URL (i.e. www.xyzname.com/OldPage.html) and seeing if you are sent to the NewPage.html.
  5. I also suggest being 100% certain a 301 redirect is being provided by using our free Server Header Checker Tool where you can copy and paste in the old address and to see for certain it is working properly.

— Websites on Windows Servers

If you are using a Windows server I am sorry to say this redirect is rather painful because a page has to exist at the old location in order to redirect visitors to the new location. In addition, there are two ways to create a redirect based on the Windows codebase utilized:

Step 1) Place a page at the position of the old web page address (http://xyzname.com/OldPage.asp)

Step 2) There are now two options for code to be placed:

If you are running a standard ASP website then place the following code above the  tag or :

<%@ Language=VBScript %>
<%
Response.Status=”302 Found”
Response.AddHeader “Location”,”http://xyzname.com/NewPage.asp”
%>

If you are running an ASP.Net website, then place the following code above the  tag or:

Step 3) Upload the new page and then test it by visiting the old URL and making sure you are redirected properly.

Step 4) Double-check a 301 redirect is being displayed by copying and pasting the old URL into our free Server Header Checker Tool.

Here are some reasons why a 302 redirect would be used:

  • A website is having technical difficulties so they 302 redirect the main URL (i.e. www.xyzname.com) to a backup website (www3.xyzname.com) while they work on the existing site.
  • In rare situations a business may choose to use a shorter URL such as xyzname.com as their branded home page URL and then 302 redirect visitors to the more complicated database-driven URL alphabet.xyzname.com/home.php?pid=home. The benefit is, if Google allows this, the business can show the XYZ.com in search results because it will not pass the link credibility it is building to the redirected URL and the URL looks a heck of a lot better in search results than the complicated version.IMPORTANT: This is not a recommended tactic but there are rare occasions where a content management system (CMS) will force this issue; especially in some Fortune 500 environments where technical flexibility is a foreign concept. Also note we are not even sure this tactic works any more!
;

IMPORTANT: Redirects are a critical step in ensuring your website is search engine friendly. That said, there are over 120 elements that also contribute to maximum search engine friendliness. These elements are discovered by conducting an effective SEO Website Audit.

Learn more:

How to 301 redirect non-www to www URLs

How to 301 redirect an old domain to a new domain

Redirects: Permanent 301 VS Temporary 302

Using a 302 In Place of a 404 is a Bad Idea

How to Temporarily Redirect One Page to Another Page

  1. If you are not familiar with managing a website from a technical standpoint you should simply tell your webmaster to create the redirect. Just tell him/her the old address and where the new address is and they will take care of it for you.
  2. If you are going to handle this on your own please pick the type of server your website is operating on below and proceed with the appropriate instructions.

— Websites on Unix/Apache Servers

  1. FTP into your website and in the root folder, download, and then create a copy of the .htaccess file and save it in a backup folder so you can restore from a file you know works if you make a mistake.
    Note: If you cannot find your .htaccess in your FTP file list see this tutorial and if it does not help please contact your server administrator for help.
  2. Open the .htaccess in a program such as Notepad++ (a free program) then prepare to type on a new line at the bottom of the existing code.
  3. Put in the redirect based on the following example (pay close attention to the spacing between the words) redirect 302 /OldPage.html http://xyzname.com/NewPage.html
  4. Save and Upload the file to your server and test the redirect by going to the old URL (i.e. www.xyzname.com/OldPage.html) and seeing if you are sent to the NewPage.html.
  5. I also suggest being 100% certain a 301 redirect is being provided by using our free Server Header Checker Tool where you can copy and paste in the old address and to see for certain it is working properly.

— Websites on Windows Servers

If you are using a Windows server I am sorry to say this redirect is rather painful because a page has to exist at the old location in order to redirect visitors to the new location. In addition, there are two ways to create a redirect based on the Windows codebase utilized:

Step 1) Place a page at the position of the old web page address (http://xyzname.com/OldPage.asp)

Step 2) There are now two options for code to be placed:

If you are running a standard ASP website then place the following code above the  tag or :

<%@ Language=VBScript %>
<%
Response.Status=”302 Found”
Response.AddHeader “Location”,”http://xyzname.com/NewPage.asp”
%>

If you are running an ASP.Net website, then place the following code above the  tag or :

Step 3) Upload the new page and then test it by visiting the old URL and making sure you are redirected properly.

Step 4) Double-check a 301 redirect is being displayed by copying and pasting the old URL into our free Server Header Checker Tool.

Have you got a basic or advanced question about 301 redirects or perhaps SEO? Post your question on the SEO 101 Radio Facebook Page & we will answer your question! SEO 101 on WebmasterRadio.fm airs live every Monday at 2pm PST / 5pm EST. (SEO 101 on iTunes)