Question:
How do I fix a 302 error on my website?
omg00dness
2009-06-13 11:51:55 UTC
I looked at the AwStats for my website and it shows a few people getting 302 errors. What causes these errors and how do I fix it? How can I find out what the problem is?
Four answers:
2009-06-13 12:29:43 UTC
302 is not an error. It is the HTTP status code for "moved temporarily," which tells the Web browser / search engine that it should continue using the URL it used in the first place.



A 302 redirect is common when using mod_rewrite, PHP's header() and other such URL-changing schemes.



People will tell you 302 redirects hurt your search engine rankings. That's bunk; there's so many of them out there, they're largely ignored. However, you can change redirection methods to send 301 -- moved permanently -- instead, if you are especially paranoid.



AWstats puts all response codes that aren't 200, including those that resulted in successful visits, under "errors." It's a misnomer.
?
2016-12-15 13:45:40 UTC
Http 302
penna
2016-09-28 09:04:16 UTC
302 Error
2009-06-13 11:55:36 UTC
HTTP Error 302 - Moved temporarily



Introduction



Your Web server thinks that your URL has been temporarily redirected to another URL. The client system is expected to immediately retry the alternate URL.



302 errors in the HTTP cycle



Any client (e.g. your Web browser or our CheckUpDown robot) goes through the following cycle when it communicates with your Web server:



Obtain an IP address from the IP name of your site (your site URL without the leading 'http://'). This lookup (conversion of IP name to IP address) is provided by domain name servers (DNSs).

Open an IP socket connection to that IP address.

Write an HTTP data stream through that socket.

Receive an HTTP data stream back from your Web server in response. This data stream contains status codes whose values are determined by the HTTP protocol. Parse this data stream for status codes and other useful information.

This error occurs in the final step above when the client receives an HTTP status code that it recognises as '302'.



Resolving 302 errors - general



The 302 response from your Web server should always include an alternative URL to which redirection should occur. If it does, a Web browser will immediately retry the alternative URL. So you never actually see a 302 error in a Web browser, unless perhaps you have a corrupt redirection chain e.g. URL A redirects to URL B which in turn redirects back to URL A. If your client is not a Web browser, it should behave in the same way as a Web browser i.e. immediately retry the alternative URL.



If the Web server does not return an alternative URL with the 302 response, then either the Web server sofware itself is defective or your Webmaster has not set up the URL redirection correctly.



Resolving 302 errors - CheckUpDown



Redirection of URLs may occur for low-level URLs (specific URLs within your Web site such as www.isp.com/products/index.html) when you reorganise your web site, but is relatively uncommon for the top-level URLs (such as www.isp.com) which most CheckUpDown users ask us to check. So this error should be fairly infrequent.



The 302 response from your Web server should always include an alternative URL to which redirection should occur. If it does, CheckUpDown automatically tries the alternative URL. This in turn may possibly lead to another redirection which CheckUpDown then tries. This continues for a maximum of 5 redirections. As soon as 5 redirections have occurred, CheckUpDown gives up and reports the 302 error for your account. So you should only ever see the 302 error if 1) your Web server gives no alternative URL on the 302 response or 2) the number of redirections exceeds 5. This second condition should be fairly unlikely - and may indicate a recursive pattern e.g. URL A redirects to URL B which in turn redirects back to URL A.



You first need to check that the IP name we use to check for your account is accurate. If you or your ISP have configured something so that any access using this name should now be redirected to another name, then you need to update your CheckUpDown account to start using the new name.



If you believe that the IP name we use is exact (should not be redirected), please try accessing the current URL using a Web browser. Note carefully which URL actually gets displayed, because your browser may silently switch to a substitute URL if it receives an 302 message from your Web server. If you see any evidence of a new URL, try accessing that directly from your browser. If this works (you see your Web site as expected), then this new URL is what you may need to update on your CheckUpDwon account. If this is a temporary redirection, then you may also need to reinstate the original IP name at a later date when the redirection is no longer effective.



If none of the above help, we can analyse the underlying HTTP data streams we receive from your Web server. These can provide additional information about the new URL(s) which your Web server thinks we should be accessing. Before doing this, we prefer you to identify any deliberate changes on your side, liaising with your ISP if needs be.



302 errors should occur infrequently, because top-level URLs do not change often. If they do change, then this is typically because a redirection URL is being suggested. This pervasive change is unlikely to occur by accident, so most often we can resolve this error by updating our system records for your account following a deliberate change of URL on your part, whether this change is temporary or permanent.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...