302 Redirect

The 302 redirection is described in RFC2616: “The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests“.

For example, using a 302 redirection from http://www.example.com/ to http://www.example.com/special-action/index.htm, means that, although the page is temporarily redirected to the special action promotional page, the preferred address to be used in the future remains http://www.example.com/. 302 redirects should be used for temporary redirections.

Browsers automatically follow these redirections. They also display the temporary address in the address bar.

The same address pointed to by the redirection will eventually be saved in the browser favorites. Although this is not what should be done according to RFC2616, it does not seem to create many problems in the real world.

302 Redirect and Search Engines

When a URL returns a 302 redirect, it means that the owner of this link asks users to continue to use this address as the redirect could be modified at some later time. The owner of the page pointed to by the redirect is not necessarily the same person and might not wish that its contents is presented as belonging to another web site.

The challenge for search engines is to allocate the content to the appropriate address.

If both addresses belong to the same domain, one can consider that the recommendation of the unique owner has to be followed.

When the addresses belong to different domains, Google and other search engines used to try to follow the rule suggested by RFC2616. This created many technical problems and potential conflicts related to intellectual property rights. After years of confusion, Yahoo and then Google decided to stop attributing a content to a URL of an external site.

The same problem existed with HTML redirects.

302 Redirect Implemented in .htaccess File

Assuming the web server allows it, it is easy to implement a 302 redirect in .htaccess.

Redirecting a page
Redirect /file-name.html http://www.domain.com/temporary-directory/temporary-file-name.html

Redirecting a directory
Redirect /directory http://www.domain.com/temporary-directory

Redirecting an entire site
Redirect / http://www.temporary-domain.com/

302 Redirect Implemented in a Server Script

The script (typically a PHP, Perl or ASP program) will have to generate a 302 header.

Redirecting a page in PHP
header(“Location: http://www.domain.com/temporary-address/temporary-file-name.html”);

Checking if a 302 Redirect Works

InternetOfficer has designed a free on-line tool to check the working of redirects. This new tool to check redirects analyses the HTTP-header and the page contents and identifies in seconds 301 and 302 redirects and HTML redirects (meta refresh).

39 Responses to “302 Redirect”

  1. Diane R says:


    Thank you for your service. With regard to use of awstats I might be interested but would need help and your fees are too high.

    I’ve read this sentence many times and don’t understand what you are trying to say: “After years of blind obedience to this unpractical rule, Yahoo and then Google decided to stop attributing a content to an external page redirecting to it.” Does it mean that they stopped attributing content to the external page? What does “redirecting to it” add to the sentence? It’s very confusing?

  2. Jean-Luc says:

    Hi Diane,

    Thanks for your comments. They help us make the web site better.

    I’ve changed the sentence in: “After years of confusion, Yahoo and then Google decided to stop attributing a content to a URL of an external site.”

    About the fees, please send an email with your requirements to awstats@internetofficer.com . We will try to find a solution that meet your needs.

  3. Katie says:

    To whom it concerns.

    Is there a tool out there that can tell me who is redirecting to my website? Which would be the opposite of what this tool does.

    Thank you in advance for your time!

  4. Steve says:

    I have been trying to work out about 302redirect but much of the material appears out of date.I have purchased a script similiar to the million dollar home page,The purpose of this to get websites to place an advert with a link to back their website, the script uses a 302 to link to the advertisers website, I have read a lot regarding 302 but cant work out if just by using it can be classed as hijacking. I dont have the knowhow to change this. I certainly dont want to harm either my site or advertisers site. can you tell me if I have a problem.

  5. Derek says:


    The referring page can be found a number of ways such as this one.


  6. Jean-Luc says:

    Derek and Katie,

    A “referring page” contains a link that can be a direct link or a redirect. To know the referring page is only a first step when you try to make a list of pages redirecting to your site. You still would need to parse each referring page to check if it contains a direct link or a redirect.

  7. Grant says:

    How can you tell if your domain registrar is using a 302 redirect or a 301 redirect?

  8. Jean-Luc says:

    Our Redirect Checker should help!

  9. Leonard Terramir says:

    I am in the process of updating my site http://www.instant-e-store.com/. I have given it a temporary subdomain and put up the new version of the site on that subdomain for testing purposes. Now I am ready to start updating the site by copying everything from the subdomain to the main domain. This process could take a few days depending on how much time I have.

    Would it be ok to use a 302 redirect to point my main domain to the subdomain temporarily untill the site is updated?

    Thanks for the help 🙂
    And thanks for the info about 302 redirects!

  10. Jean-Luc says:

    No redirect is always better than any redirect. But I agree that, in your case if you need several days to copy the files, a 302 temporary redirect is what you should use.

  11. Gabriel says:

    Hi there, I’ve an issue in a website… W3C validator display an 302 redirect when I try to validate my code, I’ve started reading about this mess, 2 days after… i don’t know why it’s redirect…

    I don’t have any type of redirection in .htaccess, also my php is clean of redirection… what you think I can check… or what can I read?


  12. Jean-Luc says:

    Hi Gabriel,

    I guess that you speak about the site you checked with our redirect checker. 😉

    Your web site redirects visitors who disabled cookies. As cookies are disabled in most robots (W3C validator, our redirect checker, Googlebot and other search engine robots), these robots get the “302 redirect” code when they try to view your home page.

  13. Gabriel says:

    tnx a lot :D.. i fix it, it was a cookie redirect on language check, you rocks 😀

  14. Ofer Ungar says:


    I would like to create a site with domain name (example) myTest.com. But I would also like to purchase myTests. com (plural – s added) so that those users who accidentally type the url with an ‘s’ would still arrive.
    I need a redirect for this, right? I read above that a permanent redirect is better to rank well with Google. What is a a permanent redirection?

  15. Jean-Luc says:

    You are right: you need a permanent redirect from myTests.com to myTest.com. You will find more details in our article about permanent redirects.

  16. Trevor says:


    If I have several domains (20) forwarding to one website with content. Is it better to set them as 301 or 302 redirects in regards to being search engine friendly? My main concern is the search engines pick up all domains and relate them to the content of the main website.



  17. Jean-Luc says:

    Hi Trevor,

    Use 301 redirects. Google will pass the link juice (pagerank) coming from your 20 domains to the canonical domain (the one with the content).


  18. Trevor says:

    Thanks Jean-Luc. Does this help improve the site rank for the canonical domain too?

  19. Jean-Luc says:

    It will improve the site rank of the canonical domain, but the 20 other domains will disappear from the SERP’s.

  20. Ben says:

    do a 302 redirect pass pagerank to the destination link?

  21. Trevor says:

    Here is another question… if I use 301 redirects to direct traffic from “Domain1” to “Domain2,” what will the search engines do when a search is made for “Domain1”?

  22. Jean-Luc says:


    Yes, a 302 redirect passes some link juice (PageRank) to the destination page. How much ? As much as a 301 redirect ? As much as a regular HTML link ? Only Google knows…

  23. Jean-Luc says:


    What do you call a search for “Domain1” ? There is no content anymore in “Domain1”, if “Domain1” is redirected to “Domain2”.

  24. Terrance Charles says:

    Thanks for explaining what it is and why it’s important. I think it’s important to know so you know that you are not losing any traffic to your website, or labeled wrong in the search engines.

    Terrance Charles

  25. RW says:

    this article has been very helpful, thank you

    i would appreciate advice on the following scenario:

    I have registered a domain called test.com
    i also have registered test.com.au (an australian domain)

    right now i am concentrating on content for test.com and until i have specific australian content set up, would like test.com.au to redirect to test.com

    eventually maybe in a year or so, i will start creating specific content for test.com.au

    which redirect should i use so that im not harmed in the search engines?

    and secondly, if i use some content/pages from the test.com in my test.com.au will google look negatively upon that as duplicate content? how does one get around that problem?


  26. Todd says:

    Thanks a lot for explaining the 302 redirects. I am running into a huge problem with those as my site appears to be switching from http to https and it causes a redirect error.

  27. Zack Katz says:

    I found your information lacking how to show that it’s only temporary. I found this on another website:
    Redirect temporary /relative_source_url http://full_destination_url/

    The temporary part I think is quite important, especially with 302.

  28. Jean-Luc says:

    Hi Zack Katz,

    Your Redirect temporary is exactly equivalent to Redirect ! When using Redirect, Apache will assume it is a temporary redirect if not otherwise specified. In other words, all 302’s are temporary redirects.

  29. Zack Katz says:

    Thanks for the clarification, Jean-Luc.

  30. KB says:

    Thanks for your clear advice on this page.
    Perhaps you can help me with my problem:
    I want to redirect any page in a directory to /new/index.html – specifically to that index page.
    When I try:
    Redirect 302 /old/ http://www.domain.org/new/index.html
    the browser tries to go to:
    (tacking on the filename that was originally called to the redirect)

    How can I redirect to a specific file from any page in the original directory?

  31. Jean-Luc says:

    Try this:
    RedirectMatch ^\/old\/ http://www.domain.org/new/index.html

  32. KB says:

    Fabulous! Just what I needed, thanks so much!

  33. harrel says:

    That’s a nice info.

  34. Andy says:

    I want to redirect one image to a different URL, but not the whole page. how do I do that? any help please?

  35. Jean-Luc says:

    In fact, you redirect a URL: the URL can be an image or a page or anything else. In .htaccess, you can have:
    Redirect /images/flowers.jpg http://www.site.com/roses.jpg

  36. Joey says:

    I’m glad this came up in the top results because you posted exactly what I need. Also, the php script is easier to follow than other methods I saw in the past.

  37. Staysure says:

    Is there a way to assign different “source” information to be passed along with the redirect url?

    For example say site example.com links to page flowers.com/flowers.htm which redirects to trees.com
    is there a way to have the redirect on flowers.com/flowers.htm change the referral source so trees.com sees the referral as coming from example.com?

  38. savings says:

    Thanks for the post, I was looking for information on how to do a 302 redirect and your site came up #1 on google. And here I am, I have two URLs which I have done a 302 redirect to another. Site A and Site B = 302 redirect to Site C. I have had this for about 7 months now , will this in anyway affect the search performance of my site?Please come back with any negative effect a 302 might cause in the long run. Site C has lost it’s PR 6 , now displays unranked..need help

  39. User says:

    Thanks for this info.


Leave a Reply

You must be logged in to post a comment.