http status code 404 - PHP: prevent direct access to page -


I have some pages that I do not want users to be able to access directly.

I work with which function I came up with:

  function prevent_direct_access () {if ($ _ server ['REQUEST_URI'] == $ _SERVER [' PHP_SELF ']) {// include_once (' 404.php '); Header ("Location: 404.php"); }}  

This does what I want, the URL is not changing, but does the content though I'm thinking the search engine has to say it's a 404 and Not for index. Keep in mind that I do not want to change the URL though.

Thank you!

Do not redirect, but send 404 status code:

  header ($ _ Server ['server_ PROTOCOL']. '404 not found', true, 404); Go out;  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -