-2

can anyone help me out with how to show 404 page using PHP. like

if(//some false condition): //show 404 page, that normally comes up when we enter incorrect URL endif;

Also i want the url in the address bar to be the incorrect one and not redirect me to 404 page.

Thanks in advance.

1

1 Answer 1

0

1) use .htaccess file

2) put a line of code into it : ErrorDocument 404 /404.php

3) content of 404.php is something like :

Sorry, the page you requested cannot be found.
Please check and retype the URL.

  • relax , the url would not change, still the one that visitor typed
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.