« Previous Next »

Thread: 302 Redirect instead of 301

Last post 11-13-2009 2:48 AM by Maxim Mesilov. 6 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (7 items)

Sort Posts:

  • 11-06-2009, 10:22 AM

    302 Redirect instead of 301

    Hello.
    We have the web-server with Windows 2008 Server + IIS 7 + php 5.2.11 installed.
    The problem is, that when we attempt to redirect with 301 status, 302 status is received by client.

    PHP-code:
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: $new_path");

    We have tried a lot with alternatives of transmitting headers, but result is always 302 redirect.

    How can we solve this problem? What is the reason for the wrong status message, transmitted to the client?

    We have the test site for solving this problem: http://85.21.218.136/
    You’re welcome!

    Thanks, Klim.

  • 11-07-2009, 7:55 AM In reply to

    Re: 302 Redirect instead of 301

  • 11-09-2009, 3:15 AM In reply to

    Re: 302 Redirect instead of 301

    We can't do this with IIS urlrewrite!

    We have the PHP-array of the rules, that has urls of old and new destinations.

    P.S. And the question was why we can't do 301 redirect by use of PHP.

    We found, that after working of FastCGIModule 301 Status is turned to 302. Is it FastCGIModule's bug?

  • 11-10-2009, 2:51 AM In reply to

    Re: 302 Redirect instead of 301

    Hi,

    I submitted a request with the URL: http://http://85.21.218.136/, and captured the responses by using Fiddler. Below are the three responses at the beginning:

    1. 301 HTTP 85.21.218.136   /                 Location: http://85.21.218.136/index.php

    2. 302 HTTP 85.21.218.136  /index.php    Location: http://rarus.ru

    3. 200 HTTP rarus.ru           /                  

    It seems the page index.php did a extra 302 redirection. You may need to check the code in the page or IIS redirect settings for the page.

    Leo Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • 11-10-2009, 3:53 AM In reply to

    Re: 302 Redirect instead of 301

    Hi,

    301 Redirect is our own attemt of solving the problem. There's no result but extra one redirect. Now we disabled this rule in the UrlRewrite module.

    The code of the page http://85.21.218.136/index.php is

    <?
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://rarus.ru");
    ?>

    This is only a test page with test redirect. The forming of the new url is much more difficult on the working production site.

    By use of fiddler you and we see, that redirect to http://rarus.ru is going with 302 status. Why?

    Yesterday, looking in freb logs, we have cleared, it is FastCGI Module, that changes HttpStatus from 301 to 302.

    Look at these freb logs:

    №147 MODULE_SET_RESPONSE_SUCCESS_STATUS
    ModuleName FastCgiModule
    Notification 128
    HttpStatus 301
    HttpReason Moved Permanently
    Notification EXECUTE_REQUEST_HANDLER

    №148 MODULE_SET_RESPONSE_SUCCESS_STATUS
    ModuleName FastCgiModule
    Notification 128
    HttpStatus 302
    HttpReason Redirect
    Notification EXECUTE_REQUEST_HANDLER

    Why FastCGI Module changes statuses from 301 to 302? In the end client receives 302 status instead of 301.

    How can we manage this? We want to redirect by use of PHP with 301 Status.

  • 11-10-2009, 9:11 AM In reply to

    Re: 302 Redirect instead of 301

    We found, that this is a bug in IIS FastCGI module:

    http://forums.iis.net/p/1158431/1907142.aspx#1907142

    Is there any bugfix available now? Or maybe someone got around the problem?

  • 11-13-2009, 2:48 AM In reply to

    Re: 302 Redirect instead of 301

    Help!

    I have a this problem too 

Page 1 of 1 (7 items)
Microsoft Communities