I want to stop direct access for dynamic url. If someone tries to access next link http://abc.com/gallery.php?id=1 then redirect to error404 page
Value of id=1 is dynamic and changes frequently. How to redirect if id=2 or any other value (0 to ∞)?
php redirect code
$curPageURL="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$url="http://abc.com/gallery.php?id=1";
if($curPageURL == $url)
{
header("Location: http://abc.com/error404");
}