nitation Posted January 8, 2009 Share Posted January 8, 2009 Hello. I have a page named foo.php, how do i force the page not to display when a user type it directly to the browser. scenario: when a user type http://www.mydomain.com/foo.php i want it to redirect the user to http://www.mydomain.com/index.php Please note: That is only when they type it. Somewhere in my code, i will still make use of foo.php I guess what am looking for is not just a header redirect. header("Location:some_link.php"); exit; Link to comment https://forums.phpfreaks.com/topic/139971-force-php-pages-not-to-load/ Share on other sites More sharing options...
blufish Posted January 8, 2009 Share Posted January 8, 2009 Use some form of redirect. To make it accept it for PHP-include just set a variable like $dummy. and then test with foo.php if (!isset($dummy)) { redirect } That way, $dummy will only be set when you PHP-include or whatever. If you are putting it in an iFrame you could have it try this. <script type='text/javascript'> if (parent.location == window.location) { parent.location = "http://www.website.com/index.php"; } </script> But that will only work with Javascript-enabled browsers. Link to comment https://forums.phpfreaks.com/topic/139971-force-php-pages-not-to-load/#findComment-732322 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.