Search code examples
httpshttp-headershttp-status-code-404

Can I use HTTPS 404 header?


Is it a good solution if I put to my 404.php file this header?

<?php
header("HTTPS/1.1 404 oldal nem található");
?>

(Instead of [...]HTTP/1.1[...]

Thank you!


Solution

  • Better alternatives are available according to use cases, this includes:

    1. To override HTTP status messages for clients that are still using HTTP/1.0
    header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
    
    1. To use the default message
    http_response_code(404);
    

    It's okay to use direct string.