Header in PHP overrides the HTTP Response code

Header in PHP overrides the HTTP Response code

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

HTTP/1.1 308 … Read more