Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I hope I am posting this in the correct place...

I'm having an issue with a 301 redirect in php. Looking at the headers, if I do a simple 301 redirect, it actually appears as a 302 redirect which is not what I am after.

This is the php code:

header("Status: 301 Moved Permanently");
header('Location: newurl');

It is running on the latest version of php, IIS7 and uses the FastCGI module (which is apparently where this bug could exist).

A quick Google finds other people with the same problem, but no actual solution. http://www.mombu.com/php/bugs-forum/t-301-redirect-returning-302-instead-3090775.html http://forums.iis.net/p/1158431/1907156.aspx

Many thanks! Paul

share|improve this question

1 Answer 1

Try this for your first line:

header("HTTP/1.0 301 Moved Permanently");

I'm going to make a bet that IIS isn't recognizing the Status: token.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.