This is a bug in IIS FastCGI module. It will be fixed in Windows 7 RTM. We are also looking into possible ways for making this fix available for IIS 7.
Marked as answer by peaceable_whale on Jun 16, 2009 06:57 AM
Thanks! The problem doesn't seemt to affect the FastCGI Modules for IIS 5.1 and IIS 6. (I was not able to reproduce it with IIS 5.1, FastCGI 1.5 and PHP 5.2.9-2 NTS on VM)
@peaceable_whale : how do you come to the conclusion, that the bug has been fixed?
i cannot give a link to test, but i have tried it on our server 2008 with iis7 and updates installed and i cannot get it to work.
I use iirf 2 to rewrite my urls and php 5.3 nts in fastCGI mode.
To redirect the old url structure to the new one i use php because of the complexity of the url structures.
This is the code i use for the redirect:
$location = 'Location: '.$redirectUrl;
header('HTTP/1.1 301 Moved Permanently');
header($location);
If i observe it with live http headers plugin for firefox it returns a 302 redirect.
So far it seems that there hasn't been released a bugfix yet.
I would be glad to be proven wrong.
One thing i noticed is that my redirect from trailing slash to non trailing slash url in iirf is not replaced with a 302 redirect, but this doesn't help in any way and it has already been pointed out by ruslany, that the replace with 302 redirect is a bug
in the fastCGI module.
If someone has any update on the matter please post it. I have to release our new site and it is due to the fifth of december...
I think the bug has been fixed in IIS 7.5. However, I am not sure if a patch or hotfox has been released for IIS 7. As a workaround, you may want to perform the redirect using the
URL Rewrite Module.
peaceable_wh...
97 Posts
IIS replaces redirect status header from PHP with 302 Redirect automatically
Jun 15, 2009 10:14 AM|LINK
Both of the following code...
returns...
instead of the expected...
Why does this happen?
HostingASPNe...
734 Posts
Re: IIS replaces redirect status header from PHP with 302 Redirect automatically
Jun 15, 2009 11:32 AM|LINK
Hello,
Try to make 301 redirect directly with IIS and tell us the result - IIS 301 Redirect .
Regards
Free ASP.NET Examples and source code.
peaceable_wh...
97 Posts
Re: IIS replaces redirect status header from PHP with 302 Redirect automatically
Jun 15, 2009 12:10 PM|LINK
301 is returned when the URL Rewrite Module is used.
ruslany
900 Posts
Microsoft
Moderator
Re: IIS replaces redirect status header from PHP with 302 Redirect automatically
Jun 16, 2009 05:05 AM|LINK
This is a bug in IIS FastCGI module. It will be fixed in Windows 7 RTM. We are also looking into possible ways for making this fix available for IIS 7.
peaceable_wh...
97 Posts
Re: IIS replaces redirect status header from PHP with 302 Redirect automatically
Jun 16, 2009 06:59 AM|LINK
Thanks! The problem doesn't seemt to affect the FastCGI Modules for IIS 5.1 and IIS 6. (I was not able to reproduce it with IIS 5.1, FastCGI 1.5 and PHP 5.2.9-2 NTS on VM)
Ruben Marti
2 Posts
Re: IIS replaces redirect status header from PHP with 302 Redirect automatically
Nov 30, 2009 07:14 PM|LINK
Is there any news on this?
I am having problems with search engines to not consider permanent redirects.
Thank you very much.
FastCGI IIS 7 302 301
peaceable_wh...
97 Posts
Re: IIS replaces redirect status header from PHP with 302 Redirect automatically
Dec 01, 2009 02:05 AM|LINK
Hi Ruben,
I think the bug has been fixed. Do you have a link for us to test?
backpacker86
3 Posts
Re: IIS replaces redirect status header from PHP with 302 Redirect automatically
Dec 02, 2009 08:48 AM|LINK
Hi @all, any update on the fix?
@peaceable_whale : how do you come to the conclusion, that the bug has been fixed?
i cannot give a link to test, but i have tried it on our server 2008 with iis7 and updates installed and i cannot get it to work.
I use iirf 2 to rewrite my urls and php 5.3 nts in fastCGI mode.
To redirect the old url structure to the new one i use php because of the complexity of the url structures.
This is the code i use for the redirect:
$location = 'Location: '.$redirectUrl; header('HTTP/1.1 301 Moved Permanently'); header($location);If i observe it with live http headers plugin for firefox it returns a 302 redirect.
So far it seems that there hasn't been released a bugfix yet.
I would be glad to be proven wrong.
One thing i noticed is that my redirect from trailing slash to non trailing slash url in iirf is not replaced with a 302 redirect, but this doesn't help in any way and it has already been pointed out by ruslany, that the replace with 302 redirect is a bug in the fastCGI module.
If someone has any update on the matter please post it. I have to release our new site and it is due to the fifth of december...
Thanks in advance
FastCGI 302 301
peaceable_wh...
97 Posts
Re: IIS replaces redirect status header from PHP with 302 Redirect automatically
Dec 02, 2009 03:25 PM|LINK
You are using IIS 7... not IIS 7.5...
I think the bug has been fixed in IIS 7.5. However, I am not sure if a patch or hotfox has been released for IIS 7. As a workaround, you may want to perform the redirect using the URL Rewrite Module.
Ruben Marti
2 Posts
Re: IIS replaces redirect status header from PHP with 302 Redirect automatically
Dec 03, 2009 07:43 AM|LINK
In my case, I find it very difficult to use URL Rewrite. A php program calculates the new URLs of articles canceled for similar items.
I also read that this problem would be corrected in version 7.5, but I have not located any update for users of version 7.
Who should know of this problem so we can see a FastCGI update for version 7?
Thank you very much.
</div>FastCGI 301 302