I have a php page which should be included in otherpage but no directly. Lets assume it as 1.php and the other page as 2.php
1.php
<?php
if($_SERVER['REQUEST_URI'] == "/1.php"){
header("Location:2.php");
}
else
{
//some code here
}
?>
2.php
<?php
include("1.php");
?>
this worked well on localhost/1.php
and have been redirected to localhost/2.php
but this had made a problem with localhost/1.php?somegetmethod=data
I found that anyone can access this page by typing ?something=something
at the end of 1.php url. How to change the code which can redirect all url which starts with localhost/1.php