http status code 404 - how to forcefully send invalid url queries to 404 page - PHP -


i have custom 404 page , working fine pages not exist.

but want show 404 page if query_string found missing/invalid/null url.

how can so?

www.example.com/mypage.php?param1=value1 if(isset($_get['param1']) && $_get['param1'] !='') {    //general code } else {    // here want redirect 404.php } 

also 404 page being accessed directly, , want prevent it.

i solved using include, marco mura suggested in comment.

www.example.com/mypage.php?param1=value1 if(isset($_get['param1']) && $_get['param1'] !='') {    //general code } else {    include "404.php"; } 

Comments

Popular posts from this blog

javascript - IndexedDB error: Uncaught DataCloneError: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned -

amazon web services - When using Cognito credentials with AWS in a browser (javascript), keep getting "missing credentials" error -

c# - How to set the datatextfield value instead of the value on a drop down list? -