Msg#: 4582 posted 12:05 am on Jul 30, 2004 (gmt 0)
For PHP pages that have moved, I need to permanently redirect users to new pages. That should be simple: Just return a 301 "Moved Permanently" status code via PHP's header command. However, my server oddly returns a 302 status instead.
I have PHP 4.3.6 running on IIS 6.0 (Windows 2003 Server) and have introduced the following PHP code:
<?php header('HTTP/1.1 301 Moved Permanently'); header('Location: [example.com...] exit(); ?>
This is a textbook example, repeated ad nauseum on the web, so it should work. I've tried a number of variations, as well. But my server is always returning a 302 status instead. For all of you who know about search engine optimization, you know what a problem that can be.
There appears to have been a bug in PHP 4.3.0 that caused this exact problem - the "Location" header would always mistakenly returned a 302 no matter what the code specified. It was supposedly fixed in 4.3.3. However, I've got 4.3.6 and it's doing the same thing.