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
Post a Comment