Working around setting rules at Apache level, Found that header('Location: filename.php') in php overrides the response code. Look at the below code :-
<?php
header('HTTP/1.1 308 Permanent Redirect'); //or Try for 4xx/5xx Code
header('Location: http://hello.php');
?>
Expected result
Actual result
302 FoundIs something wrong at Apache level or its Bug in PHP ?
Update:
As per the function documentation page this is the desired behaviour of PHP when sending the Location header.
EDIT: Sorry, misread your message. It will override the response code if you send a code different than 3xx, so it should work with a 308. Are you sure that no other HTTP code is sent back ? Does your client tries to retrieve the new resource and you see the 302 as a final result ?
FINAL EDIT: Did you try
header('Location: /some/page.php', TRUE, 308);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With