I'm not sure if this is a bug, if it's not I apologize.

Basically, by default the headers that are sent during a redirect say "HTTP/1.x 301 OK" instead of "HTTP/1.x 301 Moved Permanently"

I found changing...

    if (!empty($alias)) {
      header("HTTP/1.1 301 Moved Permanently");
      drupal_goto($alias);

To the following...

    if (!empty($alias)) {
      header("Status: 301 Moved Permanently");
      drupal_goto($alias);

Seemed to send the correct headers. I'm not sure if this is just my install environment, but I read about a similar issue with Drupals "/includes/common.inc" file in regards to a 404 OK instead of 404 Page Not Found... None the less, I'm not making sense now, this is the link that first sparked my concern. http://tips.webdesign10.com/drupal-seo-404-ok-and-htaccess

Comments

nicholasthompson’s picture

What's your system? I'll test this on mine today with Apache 2.0 and PHP 5.1 (and 4.0 on live).

hass’s picture

sounds like another PHP bug regarding status messages... On my Apache 2 it is currently working well.

niklp’s picture

I'm confused - is this a bug or not...?

nicholasthompson’s picture

Status: Needs review » Postponed (maintainer needs more info)
nicholas-thompsons-computer:~ nicholas$ curl -v http://www.thingy-ma-jig.co.uk/node/2
* About to connect() to www.thingy-ma-jig.co.uk port 80
*   Trying 85.234.144.42... * connected
* Connected to www.thingy-ma-jig.co.uk (85.234.144.42) port 80
> GET /node/2 HTTP/1.1
User-Agent: curl/7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1 OpenSSL/0.9.7l zlib/1.2.3
Host: www.thingy-ma-jig.co.uk
Pragma: no-cache
Accept: */*

< HTTP/1.1 301 Moved Permanently
< Date: Thu, 08 Feb 2007 00:01:37 GMT
< Server: Apache/2.0.54 (Fedora)
< X-Powered-By: PHP/5.0.4
< Set-Cookie: PHPSESSID=4ffmc7prfgmskgrb355fv8ht45; expires=Sat, 03 Mar 2007 03:34:57 GMT; path=/
< Expires: Sun, 19 Nov 1978 05:00:00 GMT
< Last-Modified: Thu, 08 Feb 2007 00:01:37 GMT
< Cache-Control: no-store, no-cache, must-revalidate
< Cache-Control: post-check=0, pre-check=0
< Pragma: no-cache
< Location: http://www.thingy-ma-jig.co.uk/projects/dodge-the-fart
< Content-Length: 0
< Connection: close
< Content-Type: text/html; charset=utf-8
* Closing connection #0
nicholas-thompsons-computer:~ nicholas$ 

I just ran that from my Mac Book Pro targeting my own Thingy Ma Jig site running Drupal 4.7.6 on PHP 5.0.4 and Apache 2.0.54.

Looks to me like its setting the correct header...

There is a chance that these kinds of issue are going to be VERY config related - so could people please post as much config info as they can when reporting this issue?

citricguy’s picture

I just upgraded to Drupal 5, but I still have the same issue. When PHP is run as CGI (I think this is the cause at least) you get different header output for the same code.

This is a string of code I found in another project that checks for CGI installs.
if ($api == 'cgi' OR $api == 'cgi-fcgi')

Here is my configuration:
Modules Installed

Drupal 5.x
Global Redirect 5.x
Google Analytics 5.x-1.x-dev
Google Sitemap 5.x-1.0
Node style 5.x-1.1
Meta tags 5.x-1.0
Pathauto 5.x-1.0 (disabled)
Front Page 5.x-1.6 (disabled)

Server Setup:
Server API: CGI
Apache/1.3.37 (Unix) mod_fastcgi/2.4.2 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.1b

nicholasthompson’s picture

ok - i've just got a disposable dev server setup for be to play with and break to my hearts desire. I'll try out PHP-CGI on it (once I figure out how). Without it I cant really test it.

bradlis7’s picture

Issue #64645 might contain useful information.

nicholasthompson’s picture

Status: Postponed (maintainer needs more info) » Fixed

4.7 is no longer supported and there is a fix in 5 and 6.

I also just testing my thingymajig site again (as in post #4) which is now running Lighttpd+PHP 5.2.6 in FastCGI mode. I get a proper 301 header.

Marking as fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.