Re: [PHP] Unable to override status code in certain installations..?

2008-01-21 Thread Jochem Maas

RavenWorks schreef:

Well, just for the sake of anybody in my situation finding this thread in the
future -- the workaround is to use this:

Options +FollowSymLinks
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /redirectTest2/verify.php?page=$1&%{QUERY_STRING} [L]


just to add, there is an alternative way to append query string:

RewriteRule ^(.+)$ /redirectTest2/verify.php?page=%{REQUEST_URI} [QSA,L]

just a thought.



instead of

ErrorDocument 404 /redirectTest2/verify.php

It seems to perform the same job, but because it's just mod_rewrite, it
won't show up as a 404 whatsoever, which means that even on servers that
refuse to let PHP's headers override Apache's error code, you're able to
send whatever status header you want.



RavenWorks wrote:

It's the exact same situation as this bug:
http://bugs.php.net/bug.php?id=24177
except, that bug was fixed back in PHP 4...

In my case, the server that works is running PHP 5.2.2, and the server
that DOESN'T work is running PHP 5.2.3! So either it's a bug that cropped
up (again) after 5.2.2, or there's another factor here.. (For instance,
the server on which it doesn't work is running Apache 1.3.37, and the
server that handles it correctly is running Apache 2.2.4.)

At least knowing that it's (likely) a bug, and not an obscure config
setting, is something. If no-one else has any other suggestions, I guess
I'll submit a bug report?



Richard Lynch wrote:

On Wed, January 9, 2008 4:35 pm, RavenWorks wrote:

I'm currently trying to create a system where a custom 404
ErrorDocument in
PHP is able to 301 Redirect the browser in certain cases. This works
fine on
some servers, however, on some other servers the PHP script seems to
be
unable to replace the 404 header.

Correctly overrides with '200' status:
http://fidelfilms.ca/redirectTest/

Unable to override default '404' status:
http://fraticelli.info/redirectTest/

Those two pages will look the same in a browser window, but one
returns 404
and one returns 200 (as it should, because of the header() call) --
check
with whatever browser plugin you prefer for reading HTTP headers, such
as
Live HTTP Headers for Firefox.

Returning the correct status code is important because we're migrating
a
site from one domain to another, and we don't want to lose ranking in
search
engines. (In the examples above, I return 200 as a test, but in
practice
this will be used to 301 all visitors -- and search engines -- to the
new
domain.)

My question is this: What causes PHP to be able to override the
ErrorDocument status on some servers and not others? Is it caused by
PHP's
behavior or Apache? Is this a configurable option, or was the behavior
permanently changed in a given version of either?

I think you are falling prey to a PHP bug.

You should be able to find it in:
http://bugs.php.net

You could also check the ChangeLogs:
http://php.net/ChangeLog-5.php
http://php.net/ChangeLog-4.php

I could be wrong, as my memory is rather vague on this one, and it's
always possible that you have similar/same symptoms with an entirely
different issue.








--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Unable to override status code in certain installations..?

2008-01-14 Thread RavenWorks

Well, just for the sake of anybody in my situation finding this thread in the
future -- the workaround is to use this:

Options +FollowSymLinks
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /redirectTest2/verify.php?page=$1&%{QUERY_STRING} [L]

instead of

ErrorDocument 404 /redirectTest2/verify.php

It seems to perform the same job, but because it's just mod_rewrite, it
won't show up as a 404 whatsoever, which means that even on servers that
refuse to let PHP's headers override Apache's error code, you're able to
send whatever status header you want.



RavenWorks wrote:
> 
> It's the exact same situation as this bug:
> http://bugs.php.net/bug.php?id=24177
> except, that bug was fixed back in PHP 4...
> 
> In my case, the server that works is running PHP 5.2.2, and the server
> that DOESN'T work is running PHP 5.2.3! So either it's a bug that cropped
> up (again) after 5.2.2, or there's another factor here.. (For instance,
> the server on which it doesn't work is running Apache 1.3.37, and the
> server that handles it correctly is running Apache 2.2.4.)
> 
> At least knowing that it's (likely) a bug, and not an obscure config
> setting, is something. If no-one else has any other suggestions, I guess
> I'll submit a bug report?
> 
> 
> 
> Richard Lynch wrote:
>> 
>> On Wed, January 9, 2008 4:35 pm, RavenWorks wrote:
>>> I'm currently trying to create a system where a custom 404
>>> ErrorDocument in
>>> PHP is able to 301 Redirect the browser in certain cases. This works
>>> fine on
>>> some servers, however, on some other servers the PHP script seems to
>>> be
>>> unable to replace the 404 header.
>>>
>>> Correctly overrides with '200' status:
>>> http://fidelfilms.ca/redirectTest/
>>>
>>> Unable to override default '404' status:
>>> http://fraticelli.info/redirectTest/
>>>
>>> Those two pages will look the same in a browser window, but one
>>> returns 404
>>> and one returns 200 (as it should, because of the header() call) --
>>> check
>>> with whatever browser plugin you prefer for reading HTTP headers, such
>>> as
>>> Live HTTP Headers for Firefox.
>>>
>>> Returning the correct status code is important because we're migrating
>>> a
>>> site from one domain to another, and we don't want to lose ranking in
>>> search
>>> engines. (In the examples above, I return 200 as a test, but in
>>> practice
>>> this will be used to 301 all visitors -- and search engines -- to the
>>> new
>>> domain.)
>>>
>>> My question is this: What causes PHP to be able to override the
>>> ErrorDocument status on some servers and not others? Is it caused by
>>> PHP's
>>> behavior or Apache? Is this a configurable option, or was the behavior
>>> permanently changed in a given version of either?
>> 
>> I think you are falling prey to a PHP bug.
>> 
>> You should be able to find it in:
>> http://bugs.php.net
>> 
>> You could also check the ChangeLogs:
>> http://php.net/ChangeLog-5.php
>> http://php.net/ChangeLog-4.php
>> 
>> I could be wrong, as my memory is rather vague on this one, and it's
>> always possible that you have similar/same symptoms with an entirely
>> different issue.
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Unable-to-override-status-code-in-certain-installations..--tp14723283p14804970.html
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Unable to override status code in certain installations..?

2008-01-10 Thread RavenWorks

It's the exact same situation as this bug:
http://bugs.php.net/bug.php?id=24177
except, that bug was fixed back in PHP 4...

In my case, the server that works is running PHP 5.2.2, and the server that
DOESN'T work is running PHP 5.2.3! So either it's a bug that cropped up
(again) after 5.2.2, or there's another factor here.. (For instance, the
server on which it doesn't work is running Apache 1.3.37, and the server
that handles it correctly is running Apache 2.2.4.)

At least knowing that it's (likely) a bug, and not an obscure config
setting, is something. If no-one else has any other suggestions, I guess
I'll submit a bug report?



Richard Lynch wrote:
> 
> On Wed, January 9, 2008 4:35 pm, RavenWorks wrote:
>> I'm currently trying to create a system where a custom 404
>> ErrorDocument in
>> PHP is able to 301 Redirect the browser in certain cases. This works
>> fine on
>> some servers, however, on some other servers the PHP script seems to
>> be
>> unable to replace the 404 header.
>>
>> Correctly overrides with '200' status:
>> http://fidelfilms.ca/redirectTest/
>>
>> Unable to override default '404' status:
>> http://fraticelli.info/redirectTest/
>>
>> Those two pages will look the same in a browser window, but one
>> returns 404
>> and one returns 200 (as it should, because of the header() call) --
>> check
>> with whatever browser plugin you prefer for reading HTTP headers, such
>> as
>> Live HTTP Headers for Firefox.
>>
>> Returning the correct status code is important because we're migrating
>> a
>> site from one domain to another, and we don't want to lose ranking in
>> search
>> engines. (In the examples above, I return 200 as a test, but in
>> practice
>> this will be used to 301 all visitors -- and search engines -- to the
>> new
>> domain.)
>>
>> My question is this: What causes PHP to be able to override the
>> ErrorDocument status on some servers and not others? Is it caused by
>> PHP's
>> behavior or Apache? Is this a configurable option, or was the behavior
>> permanently changed in a given version of either?
> 
> I think you are falling prey to a PHP bug.
> 
> You should be able to find it in:
> http://bugs.php.net
> 
> You could also check the ChangeLogs:
> http://php.net/ChangeLog-5.php
> http://php.net/ChangeLog-4.php
> 
> I could be wrong, as my memory is rather vague on this one, and it's
> always possible that you have similar/same symptoms with an entirely
> different issue.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Unable-to-override-status-code-in-certain-installations..--tp14723283p14738708.html
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Unable to override status code in certain installations..?

2008-01-09 Thread Richard Lynch
On Wed, January 9, 2008 4:35 pm, RavenWorks wrote:
> I'm currently trying to create a system where a custom 404
> ErrorDocument in
> PHP is able to 301 Redirect the browser in certain cases. This works
> fine on
> some servers, however, on some other servers the PHP script seems to
> be
> unable to replace the 404 header.
>
> Correctly overrides with '200' status:
> http://fidelfilms.ca/redirectTest/
>
> Unable to override default '404' status:
> http://fraticelli.info/redirectTest/
>
> Those two pages will look the same in a browser window, but one
> returns 404
> and one returns 200 (as it should, because of the header() call) --
> check
> with whatever browser plugin you prefer for reading HTTP headers, such
> as
> Live HTTP Headers for Firefox.
>
> Returning the correct status code is important because we're migrating
> a
> site from one domain to another, and we don't want to lose ranking in
> search
> engines. (In the examples above, I return 200 as a test, but in
> practice
> this will be used to 301 all visitors -- and search engines -- to the
> new
> domain.)
>
> My question is this: What causes PHP to be able to override the
> ErrorDocument status on some servers and not others? Is it caused by
> PHP's
> behavior or Apache? Is this a configurable option, or was the behavior
> permanently changed in a given version of either?

I think you are falling prey to a PHP bug.

You should be able to find it in:
http://bugs.php.net

You could also check the ChangeLogs:
http://php.net/ChangeLog-5.php
http://php.net/ChangeLog-4.php

I could be wrong, as my memory is rather vague on this one, and it's
always possible that you have similar/same symptoms with an entirely
different issue.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Unable to override status code in certain installations..?

2008-01-09 Thread RavenWorks

Hello,

I'm currently trying to create a system where a custom 404 ErrorDocument in
PHP is able to 301 Redirect the browser in certain cases. This works fine on
some servers, however, on some other servers the PHP script seems to be
unable to replace the 404 header.

Correctly overrides with '200' status:
http://fidelfilms.ca/redirectTest/

Unable to override default '404' status:
http://fraticelli.info/redirectTest/

Those two pages will look the same in a browser window, but one returns 404
and one returns 200 (as it should, because of the header() call) -- check
with whatever browser plugin you prefer for reading HTTP headers, such as
Live HTTP Headers for Firefox.

Returning the correct status code is important because we're migrating a
site from one domain to another, and we don't want to lose ranking in search
engines. (In the examples above, I return 200 as a test, but in practice
this will be used to 301 all visitors -- and search engines -- to the new
domain.)

My question is this: What causes PHP to be able to override the
ErrorDocument status on some servers and not others? Is it caused by PHP's
behavior or Apache? Is this a configurable option, or was the behavior
permanently changed in a given version of either?
-- 
View this message in context: 
http://www.nabble.com/Unable-to-override-status-code-in-certain-installations..--tp14723283p14723283.html
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php